Skip to main content
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 ...
Adam Seabridge's user avatar
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)"...
Michael West's user avatar
  • 18.3k
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 ...
Adam Seabridge's user avatar
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> ...
Mark Cassidy's user avatar
  • 25.3k
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 ...
Zachary Kniebel's user avatar
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 ...
Kam Figy's user avatar
  • 4,153
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....
Pete Navarra's user avatar
  • 14.7k
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 ...
Richard Seal's user avatar
  • 20.6k
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 = ...
Mark Cassidy's user avatar
  • 25.3k
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 ...
Mark Cassidy's user avatar
  • 25.3k
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 ...
Kam Figy's user avatar
  • 4,153
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 ...
Jason St-Cyr's user avatar
  • 6,791
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 ...
Thomas Bæk's user avatar
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 ...
Jean-François L'Heureux's user avatar
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 ...
Michael West's user avatar
  • 18.3k
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 ...
Vlad Iobagiu's user avatar
  • 18.6k
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 ...
Marek Musielak's user avatar
  • 23.9k
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 ...
Zachary Kniebel's user avatar
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 ...
Zachary Kniebel's user avatar
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 ...
Artem Prashkovich's user avatar
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....
x3mxray's user avatar
  • 3,160
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 ...
jammykam's user avatar
  • 13.9k
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 ...
Mark Cassidy's user avatar
  • 25.3k
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 ...
Richard Seal's user avatar
  • 20.6k
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 ...
Vlad Iobagiu's user avatar
  • 18.6k
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 ...
Michael West's user avatar
  • 18.3k
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, ...
Jason St-Cyr's user avatar
  • 6,791
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.
Alan Płócieniak's user avatar
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 ...
Marek Musielak's user avatar
  • 23.9k
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 ...
Richard Seal's user avatar
  • 20.6k

Only top scored, non community-wiki answers of a minimum length are eligible