Difference between ListItem.Update() and ListItem.SystemUpdate()

By Jatin Prajapati

Shows the difference between ListItem.Update() and ListItem.SystemUpdate().

When writing code for a SharePoint List, and updating the ListItem, you have seen two methods named Update() and SystemUpdate(). Both methods update the ListItem data in backend database for your site in SharePoint but there is a little difference between them.

When you call the ListItem.Update() method at that item, it updates the item data as well as the Modified and Modified By columns also.

When you call the ListItem.SystemUpdate() method at that item, it updates only the item data and does not update the Modified and Modified By columns for that Item.

Have a look at the below code.

using (SPSite site = new SPSite("http://invind106:20918/"))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList lstGroups = web.Lists["Employees"];
                    SPListItem itemWithUpdate = lstGroups.Items[0];
                    SPListItem itemWithSystemUpdate = lstGroups.Items[1];
                    itemWithUpdate["Department"] = "Department1";
                    itemWithUpdate.Update();
                    itemWithSystemUpdate["Department"] = "Department2";
                     itemWithSystemUpdate.SystemUpdate();
                 }
             }

In the above code for the itemWithUpdate I've called the Update() methods. When I inspect that Item in my site, it's Modified and Modified By columns are updated.

For the itemWithSystemUpdate I've called SystemUpdate() methods. When I inspect that Item in my site, it's Modified and Modified By columns are unchanged and other data are saved.

So, when you don't want to updated the Modified time and Modified by column values you can use the SystemUpdate() method for updating the listitem. This is specifically used when updating list items by web services.

Difference between ListItem.Update() and ListItem.SystemUpdate()  (1394 Views)