Is there any way we can set values of Created By
or Created Date
item fields in Sitecore from code behind?
Thanks
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.
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.
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();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With