SPListItem.Update Method

Updates the database with changes that are made to the list item.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableExceptionConstraintAttribute(FixedId := "thresholdexceeded", ErrorCode := , Condition := "Throttling limit is exceeded by the operation.",  _
    ErrorType := GetType(SPQueryThrottledException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "4", ErrorCode := , Condition := "ParseAndSetFieldValue or SetFieldValue tried to update a readonly field. ",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "9", Condition := "Operation is not supported.",  _
    ErrorType := GetType(InvalidOperationException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "2", Condition := "User does not have permissions to update this list item.",  _
    ErrorType := GetType(UnauthorizedAccessException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "3", Condition := "Item does not exist. It may have been deleted by another user.",  _
    ErrorType := GetType(ArgumentException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "8", Condition := "Field and list validation have failed.",  _
    ErrorCode := , ErrorType := GetType(SPListDataValidationException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "saveconflict", ErrorCode := , Condition := "Save Conflict. Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "1", ErrorCode := , Condition := "Expanded recurrence items cannot be updated.To add an item to a document library, use SPFileCollection.Add().The workflow's parent item associated with this task is currently in the recycle bin, which prevents the task from being completed.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableMethodAttribute(ReturnThisObjectState := True, CheckObjectVersion := True)> _
<ClientCallableExceptionConstraintAttribute(FixedId := "5", Condition := "A duplicate value was found.",  _
    ErrorCode := , ErrorType := GetType(SPDuplicateValuesFoundException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "6", Condition := "List validation has failed.",  _
    ErrorCode := , ErrorType := GetType(SPListDataValidationException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "7", Condition := "Field validation has failed.",  _
    ErrorCode := , ErrorType := GetType(SPListDataValidationException))> _
Public Overrides Sub Update
'Usage
Dim instance As SPListItem

instance.Update()
[ClientCallableExceptionConstraintAttribute(FixedId = "thresholdexceeded", ErrorCode = , Condition = "Throttling limit is exceeded by the operation.", 
    ErrorType = typeof(SPQueryThrottledException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "4", ErrorCode = , Condition = "ParseAndSetFieldValue or SetFieldValue tried to update a readonly field. ", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "9", Condition = "Operation is not supported.", 
    ErrorType = typeof(InvalidOperationException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "2", Condition = "User does not have permissions to update this list item.", 
    ErrorType = typeof(UnauthorizedAccessException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "3", Condition = "Item does not exist. It may have been deleted by another user.", 
    ErrorType = typeof(ArgumentException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "8", Condition = "Field and list validation have failed.", 
    ErrorCode = , ErrorType = typeof(SPListDataValidationException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "saveconflict", ErrorCode = , Condition = "Save Conflict. Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "1", ErrorCode = , Condition = "Expanded recurrence items cannot be updated.To add an item to a document library, use SPFileCollection.Add().The workflow's parent item associated with this task is currently in the recycle bin, which prevents the task from being completed.", 
    ErrorType = typeof(SPException))]
[ClientCallableMethodAttribute(ReturnThisObjectState = true, CheckObjectVersion = true)]
[ClientCallableExceptionConstraintAttribute(FixedId = "5", Condition = "A duplicate value was found.", 
    ErrorCode = , ErrorType = typeof(SPDuplicateValuesFoundException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "6", Condition = "List validation has failed.", 
    ErrorCode = , ErrorType = typeof(SPListDataValidationException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "7", Condition = "Field validation has failed.", 
    ErrorCode = , ErrorType = typeof(SPListDataValidationException))]
public override void Update()

Exceptions

Exception Condition
SPException

The list item has been modified since it was created.

-or-

The data that was supplied for updating an item is invalid.

Remarks

Note

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 SharePoint Foundation, see the SPListItem class.

See Also

Reference

SPListItem Class

SPListItem Members

Microsoft.SharePoint Namespace