• Updating SharePoint ListItems

    by  • March 6, 2011 • SharePoint-2010 • 2 Comments

    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();

    2 Responses to Updating SharePoint ListItems

    1. March 11, 2011 at 4:41 PM

      Hi,
      first of all thanks for blogging. That is useful to us to update share point .

      I have some issues if u have the solution please guide me..

      I have one info path form..in side this some registration details available…

      Now i wanna one more data with in this…

      that is i have one document library..that includes collection of files..
      Now i want to display that file inside info path form..
      if i click on that file that should open..

      Is there any webservise for this..
      if you have the solution please share with me

    2. NLV
      April 18, 2011 at 9:21 AM

      Also, SystemUpdate() will not invoke any event receivers registered to that list eg. ItemUpdating, ItemUpdated etc. But calling the normal Update() will invoke the event receivers properly.

    Leave a Reply

    Your email address will not be published. Required fields are marked *