UpdateList Method

The UpdateList method of the Lists service updates a list based on the specified field definitions and list properties.

Parameters

Return Value

An XML fragment that contains the list schema after changes are applied and a results block for every field that is new, updated, or deleted. The fragment is in the following form and can be assigned to a System.Xml.XmlNode object:

<Results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <NewFields>
      <Method ID="1">
         <ErrorCode>0x00000000</ErrorCode>
         <Field Type="DateTime" DateOnly="TRUE" DisplayName="Field1_Display_Name" FromBaseType="TRUE"
            Name="Field1_Name" ColName="datetime2" />
      </Method>
      <Method ID="2">
         <ErrorCode>0x00000000</ErrorCode>
         <Field Type="Text" DisplayName="Field2_Display_Name" Required="TRUE" FromBaseType="TRUE"
            Description="Description" Name="Field2_Name" ColName="nvarchar4" />
      </Method>
   </NewFields>
   <UpdateFields>
      <Method ID="3">
         <ErrorCode>0x00000000</ErrorCode>
         <Field Type="Number" Name="NumberColumn" DisplayName="Numbers"
            Required="TRUE" FromBaseType="TRUE" Description="Description" ColName="float1" />
      </Method>
      <Method ID="4">
         <ErrorCode>0x00000000</ErrorCode>
         <Field Type="Text" Name="Title" DisplayName="Title" Required="TRUE"
            FromBaseType="TRUE" Description="Description" ColName="nvarchar1" />
      </Method>
   </UpdateFields>
   <DeleteFields>
      <Method ID="5">
         <ErrorCode>0x00000000</ErrorCode>
      </Method>
      <Method ID="6">
         <ErrorCode>0x00000000</ErrorCode>
      </Method>
   </DeleteFields>
   <ListProperties DocTemplateUrl="" DefaultViewUrl="/Site_Name/Lists/List_Name/AllItems.aspx"
      ID="{6800A6B5-5B01-4E7B-B847-7F0C01F1F602}" Title="List_Name"
      Description="New_Description" ImageUrl="/_layouts/images/itgen.gif"
      Name="{6800A6B5-5B01-4E7B-B847-7F0C01F1F602}" BaseType="0" ServerTemplate="100"
      Created="20030619 05:35:34" Modified="20030619 05:39:43" LastDeleted="20030619 05:35:34"
      Version="11" Direction="none" ThumbnailSize="" WebImageWidth="" WebImageHeight=""
      Flags="4096" ItemCount="0" AnonymousPermMask="" RootFolder="/Site_Name/Lists/List_Name"
      ReadSecurity="1" WriteSecurity="1" Author="1" EventSinkAssembly="" EventSinkClass=""
      EventSinkData="" EmailInsertsFolder="" AllowDeletion="True" AllowMultiResponses="False"
      EnableAttachments="True" EnableModeration="False" EnableVersioning="False" Hidden="False"
      MultipleDataList="False" Ordered="False" ShowUser="True" />
</Results>

Example

The following code example modifies the fields and properties of a specified list in the current site, illustrating how to implement each parameter of the UpdateList method. The example uses the GetList method to return the version of the list and uses an XmlDocument object to create XmlNode objects for parameters.

This example requires that a using (C#) or Imports (Visual Basic .NET) directive be included for the System.Xml namespace.

Requirements

Platforms: Microsoft Windows Server 2003

Web Reference: http://Server_Name/[sites/][Site_Name/]_vti_bin/Lists.asmx