Skip to content

Instantly share code, notes, and snippets.

@ncelico
Created February 5, 2015 19:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ncelico/25b939b4fe7d647e6431 to your computer and use it in GitHub Desktop.
Modify Created Date of item in sitecore. Handy when you have items ordered by date and you want one to switch places
var itemToHack = Sitecore.Context.Database.GetItem("/sitecore/content/YouPath");
using (new Sitecore.SecurityModel.SecurityDisabler())
{
itemToHack.Editing.BeginEdit();
itemToHack[Sitecore.FieldIDs.Created] = Sitecore.DateUtil.ToIsoDate(DateTime.MinValue);
itemToHack.Editing.EndEdit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment