Reputation: 205
I need to update a sitecore item field programmatically but do not want to update it's field "Updated"
I know how to edit a sitecore item's field programmatically but at the same time i do not want to update it's "Updated" field as i am retrieving sub items from one folder so based on their updated date i need to fetch first 5 sub items.
CurrentItem.Editing.BeginEdit();
CurrentItem["MyField"] = "Hello!";
CurrentItem.Editing.EndEdit();
Now i need to run a job to update all these subitems programmatically but do not want to update it's "Updated" field
Upvotes: 0
Views: 2103
Reputation:
We can instruct Item EditContext not to update Sitecore statistics. Sample code below:
bool silent = true;
bool updateStatistics = false;
using (SecurityDisabler disabler = new SecurityDisabler())
{
using (new EditContext(item, updateStatistics, silent))
{
item["ShortHeadline"] = item["Title"];
}
}
Upvotes: 1