This topic has not yet been rated Rate this topic

SPList.Update Method

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

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
[ClientCallableExceptionConstraintAttribute(FixedId = "formula3", ErrorCode = , Condition = "Data validation criteria in the ValidataionFormula property is not supported.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "formula6", ErrorCode = , Condition = "Data validation criteria in the ValidataionFormula property is not supported.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "thresholdexceeded", ErrorCode = , Condition = "Operation exceeds the list view threshold enforced by the administrator.", 
	ErrorType = typeof(SPQueryThrottledException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "accessdenied", Condition = "User does not have permissions to update this list.", 
	ErrorType = typeof(UnauthorizedAccessException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "formula1", ErrorCode = , Condition = "Data validation criteria in the ValidataionFormula property is not supported.", 
	ErrorType = typeof(SPException))]
[ClientCallableAttribute]
[ClientCallableExceptionConstraintAttribute(FixedId = "listnotfound", ErrorCode = , Condition = "The list is not found.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "versionmismatch", ErrorCode = , Condition = "Current version of the list is older than one in the database.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "c", ErrorCode = , Condition = "List with this title already exists.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "d", ErrorCode = , Condition = "Cannot create new folder for attachments.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "formula5", ErrorCode = , Condition = "Data validation criteria in the ValidataionFormula property is not supported.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "formula2", ErrorCode = , Condition = "Data validation criteria in the ValidataionFormula property is not supported.", 
	ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "formula4", ErrorCode = , Condition = "Data validation criteria in the ValidataionFormula property is not supported.", 
	ErrorType = typeof(SPException))]
public void Update()

This method calls Update(Boolean) with false.

The following code example uses the Update method to modify several properties of a list.

using System;
using Microsoft.SharePoint;

namespace Test
{
   class ConsoleApp
   {
      static void Main(string[] args)
      {
         using (SPSite site = new SPSite("http://localhost"))
         {
            using (SPWeb web = site.OpenWeb())
            {
               SPList list = web.GetList("/lists/announcements/");
               list.EnableAttachments = false;
               list.EnableSyndication = false;
               list.Update();
            }
         }
         Console.ReadLine();
      }
   }
}
Did you find this helpful?
(2000 characters remaining)
Community Content Add
Annotations FAQ