Sunday, April 12, 2009

SPListItem: Update(), SystemUpdate() and UpdateOverwriteVersion()

If you are working with MOSS APIs to create list items and updating them, you have the option to update the item by using Update(), SystemUpdate(), SystemUpdate(false) or UpdateOverwriteVersion() methods, but what is the difference between them?

Update()

  • will make a new version of the item
  • Update the modified time and modified by fields
  • If the item is published it will be pending again
UpdateOverwriteVersion()
  • No new version.
  • Updates the item without creating a new version of the item
  • Update the modified time and modified by fields
SystemUpdate()
  • Nothing will be changed in the item except the fields you want to change
  • No new version (You can pass false to the method just to enable generating a new version)
  • The events will be fired and the modifications will be logged, but no alerts will be sent, and you can disble the event firing before using the SystemUpdate then enable it again

SystemUpdate() is very useful if you want to modify something like the rating value after the item is published without reapproving it every time.


No comments:

How to Install and Use RTSP Simple Server

  How to Install and Use RTSP Simple Server   1.   Create a folder to store the app mkdir /etc/rtsp-server cd /etc/rtsp-server   2.  Downloa...