22
votes
What is the best way to bulk-create items programmatically?
I have outlined 3 options for you below. Rocks is perhaps the easiest to setup and use but isn't so easy to use on remote environments. SPE is perhaps the most flexible and powerful option. Writing ...
17
votes
What is the best way to bulk-create items programmatically?
Sitecore PowerShell Extensions provides a great way to create items in bulk.
Here is a simple script.
foreach($index in 1..10) {
$item = New-Item -Path "master:\content\home\sample item$($index)"...
17
votes
Accepted
What does headless mean in the context of Sitecore?
What is a Headless CMS?
A headless CMS is a back-end only content management system (usually built from the ground up as a content repository) that makes content accessible via an API for display on ...
14
votes
Accepted
Exposing ServiceApiController in Sitecore 9.2
You have most of the pieces you need, but not all.
You need a patch config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<initialize>
...
13
votes
Accepted
How can I write my own custom disabler?
Sitecore's built in disablers, like the SecurityDisabler and the EventsDisabler classes, all inherit the Sitecore-provided Switcher class. This class is an IDisposable that can be used to create ...
13
votes
Accepted
Headless CMS : Sitecore vs Contentful
Full disclosure: I'm on the JSS team, so naturally I'm biased.
Contentful is fairly similar to using Sitecore's SSC REST APIs. You have a large bucket of content, and you have an API to retrieve ...
13
votes
Accepted
Is there a method in Sitecore's utilities to format a numerical file size in a friendly way?
You are correct, you probably have come across this. The Sitecore.StringUtil, Sitecore.Kernel class contains a number of methods for managing strings.
The two methods in particular are:
StringUtil....
13
votes
Accepted
When to use Sitecore.Context.Items and why?
Sitecore.Context.Items is a collection that exists for the lifetime of the http request. I use that collection for times when I need to store some data as part of a request where I will need that ...
12
votes
How to get the our local date and time from the sitecore datetime field(raw value format - yyymmddThhmmssZ)?
Sitecore stores its date/time values in UTC. And you are 5h30m ahead or behind UTC.
If you'd like to display DateTimes in Server Time:
webDB = Sitecore.Data.Database.GetDatabase("web");
var item = ...
11
votes
Accepted
TemplateManager.GetTemplates always returning null
Yea. Change your code to this:
var templatePath = "User Defined/Project/Common/Content Types/Links";
var template = TemplateManager.GetTemplate(templatePath, Context.Database);
If your path starts ...
11
votes
What is alternative of ".PageMode.IsExperienceEditor" property in JSS-react?
In addition to the built-in helper method, the pageState (normal, preview, editing) and pageEditing (boolean) properties are also available in the layout service context, which there are samples of in ...
10
votes
Service based architecture in sitecore
Yes, it is possible to achieve your architecture using Sitecore. There are a few options for you here to do headless implementations, each with their own advantages and disadvantages, and different ...
10
votes
Accepted
How to rebuild Lucene Index using API?
You should have a look at the documentation form Sitecore:
https://doc.sitecore.net/sitecore_experience_platform/80/setting_up_and_maintaining/search_and_indexing/indexing/rebuild_search_indexes
You ...
10
votes
Accepted
What is alternative of ".PageMode.IsExperienceEditor" property in JSS-react?
That would be isExperienceEditorActive defined in @sitecore-jss/sitecore-jss.
Usage:
import { isExperienceEditorActive } from "@sitecore-jss/sitecore-jss";
if (isExperienceEditorActive()) {
// Do ...
10
votes
Accepted
Accessing SXA Site Grouping Site Settings Properties from Code
These items can be queried using code like this:
var siteInfo = ServiceLocator.ServiceProvider.GetService<ISiteInfoResolver>().GetSiteInfo(Context.Item);
if (siteInfo != null)
{
var ...
10
votes
Accepted
The type or namespace name 'Job' could not be found (are you missing a using directive or an assembly reference?)
The Sitecore.Jobs.Job and Sitecore.Jobs.JobOptions classes have been removed in Sitecore 9.2. In their place you now have BaseJob and BaseJobOptions abstractions with DefaultJob and DefaultJobOptions ...
9
votes
Accepted
How do I get an Item from Sitecore's internal URI protocol?
It's Sitecore.Data.ItemUri format. You can use
var itemUri = ItemUri.Parse(string itemUriString)
to get ItemUri class object and then
Sitecore.Data.Database.GetItem(ItemUri itemUri)
to get the ...
9
votes
Accepted
"Silently" Create Item - Create Item Without Triggering Indexing or other Events
If you decompile and have a look at the Sitecore.Data.Items.ItemEditing class, in Sitecore.Kernel, you will find that all the EndEdit(bool) method does (and the relevant parts of its overload methods ...
9
votes
What is the best way to bulk-create items programmatically?
Sitecore actually provides an OOTB item generator tool, named "FillDB."
You can access this tool by navigating to http://yoursite.com/sitecore/admin/filldb.aspx. Before you can use the tool, you will ...
9
votes
What’s the best practice to Expose Sitecore 9 APIs for Mobile Apps Development?
Sitecore JSS is pretty match to your requirements in terms you want to use analytics, tracking, rule engine personalization, control on component rendering. But you should't think about JSS in ...
9
votes
Accepted
JWT tokens for authentication for 9.0 UPDATE 1
You can implement custom DelegatingHandler base on Sitecore.Services behavior:
using System.Linq;
using System.Net.Http;
using System.Security.Claims;
using System.Threading;
using System.Threading....
9
votes
Accepted
Is the 100 child item limit still a valid rule of thumb?
It's still a good rule of thumb, even if there was no technical reason for it then at least from a UX perspective. Having a large number of items makes it more difficult for authors to be able to find ...
9
votes
When to use Sitecore.Context.Items and why?
So it has already been answered, but I feel I can add to it.
The use case is, if you have something going on early in a request cycle that you want to share or use later. As mentioned, the most ...
8
votes
Best way to Use Sitecore Data for other Application?
This is a tricky question to answer as what is "best" can often depend on your solution.
So let's look at the options:
Item Web API - as @sitecorebasics said, the Item Web API is not supported in ...
8
votes
Accepted
Item statistic "CreatedBy" returning empty string
"Statistics.CreatedBy" property does not return standard values.
To fix this problem please use : blogPost.Fields["__created by"].Value
Statistics.Created use next code:
private string ...
8
votes
Accepted
How to copy an item to multiple locations
SPE is likely going to be your best lower effort approach. The book provides several examples for creating Context Menu options and prompting for input.
Creating
New-Item allows for the creation of ...
8
votes
Accepted
Change field type from Droplist to Droplink
You cannot use the existing data directly to go from drop list to droplink as they stored data differently. Droplist has the display name, and droplink has the GUID of the item.
In order to convert, ...
8
votes
Accepted
How to unlock sitecore items programmatically
There is a Locking API that you can use.
Now it is up to you how you will process all items and unlock them. You can create a job, SPE (Sitecore Powershell Extensions) script.
8
votes
Accepted
What is Sitecore.Abstractions dll?
Quoting Ruud van Falier (Sitecore.Abstractions.dll in Sitecore 7.5):
Sitecore 7.5 ships with a new binary named Sitecore.Abstractions.dll
This offers you abstractions for some parts of the ...
7
votes
Sitecore search for multiple children with same name and path
Your problem is that the links will be generating a path, and all the links will have a path like:
/newsitems/news
Sitecore can only match an item there by path name, so its going to pick the first ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sitecore-api × 399sitecore-client × 54
jss × 26
sxa × 16
xconnect × 16
solr × 15
sitecore-commerce × 15
webapi × 12
graphql × 11
powershell-extensions × 10
content-search × 9
sitecore-forms × 9
media-library × 9
mvc × 9
sitecore-services-client × 9
item-web-api × 9
azure × 8
glass-mapper × 8
pipelines × 8
security × 7
xdb × 6
experience-editor × 5
upgrade × 5
sitecore-query × 5
authentication × 5