Category Archives: c#

Change date format using .NET Regular Expressions

You can use Regex.Replace to change the format of a date string. For example if your input string is YYYY/MM/DD but you need to change it to YYYY-MM-DD, you can use this small method: Regular expressions are unreadable as usual, … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , | 1 Comment

Sitecore Item Clones is only a thing in the master database

The Sitecore item cloning is a technique in which you can create a copy of an item that inherits the field values of the original items. In the latest versions of Sitecore (at least from 9.0 and forward) you can … Continue reading

Posted in c#, Sitecore 8, Sitecore 9 | Tagged , , | Leave a comment

Sitecore start scheduled task manually

Sitecore scheduled tasks are background tasks running on a schedule. But never when you need it, especially when developing the tasks. You can trigger these tasks manually if you please. THE EASY WAY: INSTALL SITECORE POWERSHELL The Sitecore PowerShell module … Continue reading

Posted in .net, c#, General .NET, Sitecore 5, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , | Leave a comment

Sitecore get Context from fully qualified URL

One of the basic Sitecore concepts is the concept of a context. The context is resolved from the HTTP Context to Sitecore and determines the database, language, user domain, content start item etc. The context is defined in the App_Config/Sitecore.config … Continue reading

Posted in .net, c#, General .NET, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , , | Leave a comment

Deserialize XML array to string[] and how to allow JSON to be deserialized into the same POCO class

How do you deserialize the classic XML array to an string[] type? The XML representation of an array is a list of elements: And the MyArray would normally be deserialized to an annoying class: The solution is to use the … Continue reading

Posted in .net, c#, General .NET | Tagged , , , , | Leave a comment

Read from Azure Queue with Azure WebJobs 3.0 and .NET Core

From WebJobs 2.0 to WebJobs 3.0 Microsoft have completely rewritten the way Azure WebJobs is used. The reasons are probably noble, but they require you to redo your work when upgrading. So I made this template that allows me to … Continue reading

Posted in .NET Core, c# | Tagged , , , | Leave a comment

Sitecore Pipelines – The great walkthrough

I have previously stated my enthusiasm for the Sitecore Pipeline concept. This article describes how to create your own, how to add parameters, and which properties to use. WHAT IS A SITECORE PIPELINE? It is best described as a simple … Continue reading

Posted in .net, c#, General .NET, Sitecore 5, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , , , , , , | Leave a comment

Sitecore disable automatic lock on create items

From Sitecore 9, Sitecore changed the default behavior when creating items in the content editor. As per default, any item is locked when created, and will only be unlocked if the user unlocks it, or the user saves the item, … Continue reading

Posted in .net, c#, General .NET, Sitecore 9 | Tagged , , , | 5 Comments

Sitecore delete old item versions

Are your Sitecore editors version-trigger-happy? Is your master database items drowning in old versions that will never be used – or is just exact replicas of the previous version? Fear not, you can in fact – with a little bit … Continue reading

Posted in .net, c#, General .NET, Sitecore 5, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , | 2 Comments

Serilog – Add thread ID to the log file

Serilog is more or less the default file logger when developing .NET Core applications. The simple logger can easily be modified to – for example – add the thread ID. FIRST THINGS FIRST: THE SERILOG NUGET PACKAGES You need these … Continue reading

Posted in .NET Core, c#, Microsoft Azure | Tagged , , | Leave a comment