Sitecore Stuff and Such

- by Christian Kay Linkhusen

NAVIGATION - SEARCH

Update Items without changing theirs statistics

I have a small tip to you, when you have to update items in your Sitecore solution from a batch job or a script correcting data on several items in the solution. It is possible to accomplice this without changing the fields "Updated by" and "Updated", there by your script will not overwrite the original data about, who updated the item and when.
 
This is simply done by setting the updateStatistics flag to false when editing the Item.

    using (new SecurityDisabler())
    {
        var items = Sitecore.Context.Item.Children;
        foreach (var scItem in items)
        {
            using (new EditContext(scItem, false, false))
            {
                //update whatever data on your childitem you have to correct
                //without changing the statistics fields
            }
        }
    }

Thats all folks - hapii coding ;)