Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Created By value in Sitecore

Is there any way we can set values of Created By or Created Date item fields in Sitecore from code behind?

Thanks

like image 471
sanjeev40084 Avatar asked Apr 09 '13 15:04

sanjeev40084


People also ask

What is standard Sitecore value?

Standard values are used when a field value for an item is set to NULL. When viewing an item in the Content Editor, any field that contains a standard value is indicated by the token [standard value] immediately next to the field title as shown in the following image.

What is standard field in Sitecore?

Sitecore Standard Template contains the Fields which define how Sitecore should manage an Item, such as when it should be published, which workflow it is in, which users should be allowed to access it, and so on. When an Item is selected in the Content Editor, you can see the sections of its template in the right pane.


1 Answers

Just update it using the item's fields, for example:

using (new Sitecore.SecurityModel.SecurityDisabler())
{
    item.Editing.BeginEdit();
    item[Sitecore.FieldIDs.Created] = Sitecore.DateUtil.ToIsoDate(DateTime.Now);
    item.Editing.EndEdit();
}
like image 200
Ruud van Falier Avatar answered Sep 21 '22 01:09

Ruud van Falier