SharePoint In Action

An attempt to share my day-to-day SharePoint experience

Archive for the month “February, 2013”

Updating a SharePoint ListItem With No Trace In Item Version!

Hi,

Case:
Today I had to write a method to update a SharePoint list every 30 mins but since it had the versioning on, I needed to turn the versioning off when the list was updated programmatically. The versioning needed to be on for manual updates.

Solution:
I had to change the SPListItem.Update() with SPListItem.SystemUpdate()

Details:
Basically SPListItem.Update() updates the database along with “Modified” and “Modified By” fields and the modifications will be added in the Change and Audit logs. It also updates the item version.
In order to leave no trace on those fields and item version you would need to use SPListItem.SystemUpdate() which does all behind the scene works except updating those fields and the item version.

You can also use UpdateOverwriteVersion() to avoid adding a new item version but note that it WILL update the “Modified” and “Modified By” fields.

Cheers,
Nader Heshmat

Advertisements

Post Navigation