Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
SDK Documentation
SPListItem Class
SPListItem Methods
 Update Method
Community Content
In this section
Statistics Annotations (1)
Collapse All/Expand All Collapse All
This page is specific to
The 2007 product release

Other versions are also available for the following:
SPListItem.Update Method (Microsoft.SharePoint)
Updates the database with changes that are made to the list item.

Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Visual Basic (Declaration)
Public Overrides Sub Update
Visual Basic (Usage)
Dim instance As SPListItem

instance.Update
C#
public override void Update ()

The Update method returns an SPException exception if the list item has been modified since it was created. For example, this exception is returned if the code returns an SPListItem object but code in a different HTTP request has updated the item previously. This exception is also raised when the data that was supplied for updating an item is invalid.

NoteNote:

When a document is checked out from a document library, its metadata cannot be modified by using the Update method.

For information about specific data formats that are used for list items in Windows SharePoint Services, see the SPListItem class.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Update Exception      Elliot Wood   |   Edit   |   Show History
The Update method returns a Microsoft.SharePoint.SPException exception if the list item has been modified since it was created. For example, this exception is returned if the code returns an SPListItem object but code in a different HTTP request has updated the item previously. This exception is also raised when the data that was supplied for updating an item is invalid.

If you are experiencing this problem when updating a second time or when using CopyTo() method, try getting the List Item again. For example...

sourcePage.CopyTo(newPageUrl);
SPListItem newPage = variationWeb.GetFile(newPageUrl).Item;
newPage.Update();
//CheckIn
//Publish
//Approve
//Do Changes to newPage, e.g. Update Fields
//At this point calling .Update() again will throw the exception.
//Below is to allow .Update() to work
newPage = null;
newPage = SPWeb.GetFile(newPageUrl).Item;
newPage.Update();
//CheckIn
//Publish
//Approve
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker