Updating SPListItem without changing versions
The below snippet is usually used to update SPListItems. The Item.Update() updates the database with the changes, creates a new version and changes the Modified and Modified By fields.
SPList list = web.Lists["List1"];
SPListItem item = list.Items[0];
item["Field1"] = “Test”;
item.Update();
list.Update();
If you want to avoid version changes, Modified and Modified By fields from getting updated , Item.SystemUpdate() would be the right way to do it.
SPList list = web.Lists["List1"];
SPListItem item = list.Items[0];
item["Field1"] = “Test”;
item.SystemUpdate(false);
list.Update();
The argument false informs the SP object Model not increment versions.
Advertisement
