Partilhar via


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

Syntax

'Declaration
<ClientCallableExceptionConstraintAttribute(FixedId := "formula3", ErrorCode := , Condition := "Data validation criteria in the ValidataionFormula property is not supported.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "formula6", ErrorCode := , Condition := "Data validation criteria in the ValidataionFormula property is not supported.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "thresholdexceeded", ErrorCode := , Condition := "Operation exceeds the list view threshold enforced by the administrator.",  _
    ErrorType := GetType(SPQueryThrottledException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "accessdenied", Condition := "User does not have permissions to update this list.",  _
    ErrorType := GetType(UnauthorizedAccessException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "formula1", ErrorCode := , Condition := "Data validation criteria in the ValidataionFormula property is not supported.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableAttribute> _
<ClientCallableExceptionConstraintAttribute(FixedId := "listnotfound", ErrorCode := , Condition := "The list is not found.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "versionmismatch", ErrorCode := , Condition := "Current version of the list is older than one in the database.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "c", ErrorCode := , Condition := "List with this title already exists.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "d", ErrorCode := , Condition := "Cannot create new folder for attachments.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "formula5", ErrorCode := , Condition := "Data validation criteria in the ValidataionFormula property is not supported.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "formula2", ErrorCode := , Condition := "Data validation criteria in the ValidataionFormula property is not supported.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "formula4", ErrorCode := , Condition := "Data validation criteria in the ValidataionFormula property is not supported.",  _
    ErrorType := GetType(SPException))> _
Public Sub Update
'Usage
Dim instance As SPList

instance.Update()
[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()

Remarks

This method calls Update(Boolean) with false.

Examples

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

Imports System
Imports Microsoft.SharePoint

Module ConsoleApp
   Sub Main()
      Using site As SPSite = New SPSite("https://localhost")
         Using web As SPWeb = site.OpenWeb()

            Dim list As SPList = web.GetList("/lists/announcements/")
            list.EnableAttachments = False
            list.EnableSyndication = False
            list.Update()

         End Using
      End Using

      Console.ReadLine()
   End Sub
End Module
using System;
using Microsoft.SharePoint;

namespace Test
{
   class ConsoleApp
   {
      static void Main(string[] args)
      {
         using (SPSite site = new SPSite("https://localhost"))
         {
            using (SPWeb web = site.OpenWeb())
            {
               SPList list = web.GetList("/lists/announcements/");
               list.EnableAttachments = false;
               list.EnableSyndication = false;
               list.Update();
            }
         }
         Console.ReadLine();
      }
   }
}

See Also

Reference

SPList Class

SPList Members

Update Overload

Microsoft.SharePoint Namespace