Set Created by value in Sitecore

Is there a way to set the field values โ€‹โ€‹of Created By or Created Date elements in Sitecore from code?

thanks

+6
source share
1 answer

Just update it using element fields, for example:

 using (new Sitecore.SecurityModel.SecurityDisabler()) { item.Editing.BeginEdit(); item[Sitecore.FieldIDs.Created] = Sitecore.DateUtil.ToIsoDate(DateTime.Now); item.Editing.EndEdit(); } 
+11
source

All Articles