Updating SharePoint ListItems

There are two methods available to update the List Items on SPListItem Object.
SPListItem.Update();
SPListItem.SystemUpdate();

SPListItem.Update() used to update all the values in SharePoint List Item including pre-defined hidden fields. If we modified the item, that will affects the Modified Date, Modified By, Version information fields.

SPList olist = oweb.Lists.TryGetList(“ListName”);
SPListItem olistitem = olist.Items[1];
olistitem.Title = “Sample List Item”
olistitem.Update();
olist.Update();

SPListItem.SystemUpdate() method used to update the values of the listitem without modifying the Modified Date, Modified By and Version information fields.

SPList olist = oweb.Lists.TryGetList(“ListName”);
SPListItem olistitem = olist.Items[1];
olistitem.Title = “Sample List Item”
olistitem.SystemUpdate();
olist.Update();

Comments