Friday, July 24, 2009

What is the difference between SPListItem.SystemUpdate and SPListItem.Update Method (Microsoft.SharePoint)

What is the difference between SPListItem.SystemUpdate and SPListItem.Update Method (Microsoft.SharePoint):

SPListItem.SystemUpdate:

Updates the database(Sharepoint list) with changes that are made to the list item, without effecting changes in the Modified Time or Modified By fields.

SPListItem.SystemUpdate Overloaded Method:

SPListItem.SystemUpdate():
Updates the database with changes made to the list item, without effecting changes in the Modified or Modified By fields.

SPListItem.SystemUpdate(Boolean):
Updates the database with changes that are made to the list item, without effecting changes in the Modified Time or Modified By fields, or optionally, the item version.

Example:

//Take the reference of that item

SPListItem listItem = listItemCOll[icount];

listItem["FIRST_NAME"] = “Amit”;

listItem["LAST_NAME"] = “Kumar”;

listItem["EMAIL_ADDR"] = “mcapassion@gmail.com”;

//Update the Item

listItem.SystemUpdate(false);

The argument false informs the SP object Model not increment versions.



SPListItem.Update:

SPListItem.Update():
Updates the database(Sharepoint list) with changes that are made to the list item/new version of item, and changes in the Modified Time or Modified By fields.


Example:

//Take the reference of that item

SPListItem listItem = listItemCOll[icount];

listItem["FIRST_NAME"] = “Amit”;

listItem["LAST_NAME"] = “Kumar”;

listItem["EMAIL_ADDR"] = “mcapassion@gmail.com”;

//Update the Item

listItem.Update();
Share:

0 comments:

About Me

My photo
Based in Bangalore, INDIA, Amit is a MCC. He has an MCA from the U.P.T.U., INDIA and holds Microsoft certifications including SharePoint 2007/2010/2013. He is an contributor to MSDN and http://amitkumarmca04.blogspot.com/. Amit have experience in SharePoint,ASP.Net with C#, Classic ASP, VB,Macros,HTML,JavaScript,JSON,BootStrap and AngularJS.

Followers

Labels