Thursday, May 15, 2008

Updating SPListItem from code

I was writing some codes to update some of the SPListItem column values. Typically after changing the column values of an SPListItem, you have to invoke the SPListItem.Update() method to commit the changes. Later on I found out there’s two other update method, namely SPListItem.SystemUpdate() and SPListItem.UpdateOverwriteVersion().

SystemUpdate() updates the SPListItem without affecting the system dates of the item and version number. So this is useful for my case as my little console application are performing mass update from behind the scene. As for UpdateOverwriteVersion(), I’m not sure what it does, base on description it overwrites the current version, which I think would affect the system dates and version.

 

More reference at MSDN:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.systemupdate.aspx

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.updateoverwriteversion.aspx

No comments: