Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

4.2 Create and Update a List

SharePoint

In this scenario, the user wants to create and update a new list named "ListOfColors", and use the CustomList template to create this list. The user looks up the information and finds out that the list template identifier for the CustomList template (for more information, see [MS-WSSFO2] section 2.2.3.2) is 100. The user further wants to get a change token before adding any rows, so the user can retrieve all data updates that have happened to "ListOfColors" at a later point. The user then wants to add three new rows: one row that has the title field set to "red", a second row that has the title field set to "blue", and a third row that has the title field set to "green". Finally, the user wants to retrieve all data updates to the list that have happened after the list was created.

The steps for this task are as follows (note that any … in the following examples indicate that part of the response was left out to improve readability):

The protocol client issues an AddList command (section 3.1.4.3) as follows:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
  <AddList xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <listName>ListOfColors</listName>
   <templateID>100</templateID>
  </AddList>
 </soap:Body>
</soap:Envelope> 

The server responds with an AddList response as follows:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <soap:Body>
  <AddListResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <AddListResult>
    <List>                  . . .
    </List>
   </AddListResult>
  </AddListResponse>
 </soap:Body>
</soap:Envelope>

The protocol client issues a GetListItemChangesSinceToken (section 3.1.4.22), without a token, to get the latest change token for use later as follows:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body> 
  <GetListItemChangesSinceToken xmlns="http://schemas.microsoft.com/sharepoint/soap/"> 
   <listName>ListOfColors</listName>
   <viewName></viewName>
   <query>
    <Query>
     <OrderBy>
      <FieldRef Name="ID"/>
     </OrderBy>
    </Query>
   </query>
   <viewFields>
    <ViewFields>
     <FieldRef Name="ID" />
     <FieldRef Name="Title" />
    </ViewFields>
   </viewFields>
   <rowLimit>10</rowLimit>
   <queryOptions>
    <Query/>
   </queryOptions>
  </GetListItemChangesSinceToken> 
 </soap:Body>
</soap:Envelope>

The server responds with a GetListItemChangesSinceTokenResponse as follows:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <soap:Body>
  <GetListItemChangesSinceTokenResponse xmlns="http://schemas.microsoft.com/sharepoint/
soap/">
   <GetListItemChangesSinceTokenResult>
    <listitems MinTimeBetweenSyncs='0' RecommendedTimeBetweenSyncs='180' MaxBulkDocumentSyncSize='500' AlternateUrls='http://www.tailspintoys.com/' EffectivePermMask='FullMask' xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
     xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
     xmlns:rs='urn:schemas-microsoft-com:rowset'
     xmlns:z='#RowsetSchema'>
     <Changes LastChangeToken="1;3;7ffc2f13-9163-4e9f-bf4e-a3f34d882e8f;633386310765830000;799">
      <List>         // deleted because of size
       ...
      </List>
     </Changes>
     <rs:data ItemCount="0">
     </rs:data>
    </listitems>
   </GetListItemChangesSinceTokenResult>
  </GetListItemChangesSinceTokenResponse>
 </soap:Body>
</soap:Envelope>

The protocol client issues an UpdateListItems request (section 3.1.4.31) to add new rows as follows:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
  <UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <listName>ListOfColors</listName>
   <updates>
    <Batch OnError="Continue">
     <Method ID="1" Cmd="New">
      <Field Name="ID">New</Field>
      <Field Name="Title">Red</Field>
     </Method>
     <Method ID="2" Cmd="New">
      <Field Name="ID">New</Field>
      <Field Name="Title">Blue</Field>
     </Method>
     <Method ID="3" Cmd="New">
      <Field Name="ID">New</Field>
      <Field Name="Title">Green</Field>
     </Method>
    </Batch>
   </updates>
  </UpdateListItems>
 </soap:Body>
</soap:Envelope>

The server responds with an UpdateListItemsResponse as follows:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <soap:Body>
  <UpdateListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <UpdateListItemsResult>
    <Results>
     <Result ID="1,New">
      <ErrorCode>0x00000000</ErrorCode>
      <ID />
      <z:row ows_ID="1" ows_ContentTypeId="0x0100C6549B8AFD10DD409B9ED11D
66B944E3" ows_ContentType="Item" ows_Title="Red" ows_Modified="2008-02-14 16:13:02" ows_Created="2008-02-14 16:13:02" ows_Author="1;#Lori Kane" ows_Editor="1;#Lori Kane" ows_owshiddenversion="1" ows_WorkflowVersion="1" ows__UIVersion="512" ows__UIVersionString="1.0" ows_Attachments="0" ows__ModerationStatus="0" ows_LinkTitleNoMenu="Red" ows_LinkTitle="Red" ows_SelectTitle="1" ows_Order="100.000000000000" ows_GUID="{9E943591-254C-4B61-AE10-3504
454D96A2}" ows_FileRef="1;#Lists/ListOfColors/1_.000" ows_FileDirRef="1;#Lists/ListOfColors" ows_Last_x0020_Modified="1;#2008-02-14 16:13:02" ows_Created_x0020_Date="1;#2008-02-14 16:13:02" 
ows_FSObjType="1;#0" ows_PermMask="0x7fffffffffffffff" 
ows_FileLeafRef="1;#1_.000" ows_UniqueId="1;#{DC043241-B825-4B59-8A77-ED4C3F71B186}" ows_ProgId="1;#"
 ows_ScopeId="1;#{E274659B-1C41-4FE7-910D-551CC39D583B}" ows__EditMenuTableStart="1_.000" ows__EditMenuTableEnd="1" ows_LinkFilenameNoMenu="1_.000" ows_LinkFilename="1_.000" ows_ServerUrl="/Lists/ListOfColors/1_.000" ows_EncodedAbsUrl="http://www.tailspintoys.com/Lists/ListOfColors/1_.000" ows_BaseName="1_" ows_MetaInfo="1;#" ows__Level="1" ows__IsCurrentVersion="1" xmlns:z="#RowsetSchema" />
     </Result>
     <Result ID="2,New">
      <ErrorCode>0x00000000</ErrorCode>
      <ID />
      <z:row ows_ID="2" ows_ContentTypeId="0x0100C6549B8AFD10DD409B9ED11D66B944E3" ows_ContentType="Item" ows_Title="Blue" ows_Modified="2008-02-14 16:13:02" o
ws_Created="2008-02-14 16:13:02" ows_Author="1;#Lori Kane" ows_Editor="1;#Lori Kane" ows_owshiddenversion="1" ows_WorkflowVersion="1" ows__UIVers
ion="512" ows__UIVersionString="1.0" ows_Attachments="0" ows__ModerationStatus="0" ows_LinkTitleNoMenu="Blue" ows_LinkTitle="Blue" ows_SelectTitle="2" 
ows_Order="200.000000000000" ows_GUID="{7B3A8798-55BF-442D-9211-B1BF358FFFD9}" ows_FileRef="2;#Lists/ListOfColors/2_.000" ows_FileDirRef="2;#Lists/List
OfColors" ows_Last_x0020_Modified="2;#2008-02-14 16:13:02" ows_Created_x0020_Date="2;#2008-02-14 16:13:02" ows_FSObjType="2;#0" ows_PermMask="0x7ffffff
fffffffff" ows_FileLeafRef="2;#2_.000" ows_UniqueId="2;#{6445B756-366D-4527-AF2B-31199DAA4D36}" ows_ProgId="2;#" ows_ScopeId="2;#{E274659B-1C41-4FE7-91
0D-551CC39D583B}" ows__EditMenuTableStart="2_.000" ows__EditMenuTableEnd="2" ows_LinkFilenameNoMenu="2_.000" ows_LinkFilename="2_.000" ows_ServerUrl="/
Lists/ListOfColors/2_.000" ows_EncodedAbsUrl="http://www.tailspintoys.com/Lists/ListOfColors/2_.000" ows_BaseName="2_" ows_MetaInfo="2;#" ows__Level="1" ows__IsCu
rrentVersion="1" xmlns:z="#RowsetSchema" /></Result><Result ID="3,New"><ErrorCode>0x00000000</ErrorCode><ID /><z:row ows_ID="3" ows_ContentTypeId="0x01
00C6549B8AFD10DD409B9ED11D66B944E3" ows_ContentType="Item" ows_Title="Green" ows_Modified="2008-02-14 16:13:02" ows_Created="2008-02-14 16:13:02" ows_A
uthor="1;#Lori Kane" ows_Editor="1;#Lori Kane" ows_owshiddenversion="1" ows_WorkflowVersion="1" ows__UIVersion="512" ows__UIVersionString="1.0" o
ws_Attachments="0" ows__ModerationStatus="0" ows_LinkTitleNoMenu="Green" ows_LinkTitle="Green" ows_SelectTitle="3" ows_Order="300.000000000000" ows_GUI
D="{8A156CFF-0CBA-41A4-BAA1-C6696847F8BD}" ows_FileRef="3;#Lists/ListOfColors/3_.000" ows_FileDirRef="3;#Lists/ListOfColors" ows_Last_x0020_Modified="3
;#2008-02-14 16:13:02" ows_Created_x0020_Date="3;#2008-02-14 16:13:02" ows_FSObjType="3;#0" ows_PermMask="0x7fffffffffffffff" ows_FileLeafRef="3;#3_.00
0" ows_UniqueId="3;#{1ADFAB90-5569-4CEC-BB73-39D43720AC51}" ows_ProgId="3;#" ows_ScopeId="3;#{E274659B-1C41-4FE7-910D-551CC39D583B}" ows__EditMenuTable
Start="3_.000" ows__EditMenuTableEnd="3" ows_LinkFilenameNoMenu="3_.000" ows_LinkFilename="3_.000" ows_ServerUrl="/Lists/ListOfColors/3_.000" ows_Encod
edAbsUrl="http://www.tailspintoys.com/Lists/ListOfColors/3_.000" ows_BaseName="3_" ows_MetaInfo="3;#" ows__Level="1" ows__IsCurrentVersion="1" xmlns:z="#RowsetSch
ema" />
     </Result>
    </Results>
   </UpdateListItemsResult>
  </UpdateListItemsResponse>
 </soap:Body>
</soap:Envelope>

The protocol client issues another GetListItemChangesSinceToken request. This time with a changeToken parameter to get all changes after the changeToken was issued as follows:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.or
g/soap/envelope/">
 <soap:Body> 
  <GetListItemChangesSinceToken xmlns="http://schemas.microsoft.com/sharepoint/soap/"> 
   <listName>ListOfColors</listName>
   <changeToken>
    1;3;0746ca42-e21e-4d24-a713-f5de94f8189f;633386250004270000;779
   </changeToken>
   <viewName></viewName>
   <query>
    <Query>
     <OrderBy>
      <FieldRef Name="ID"/>
     </OrderBy>
    </Query>
   </query>
   <viewFields>
    <ViewFields>
     <FieldRef Name="ID" />
     <FieldRef Name="Title" />
    </ViewFields>
   </viewFields>
   <rowLimit>10</rowLimit>
   <queryOptions>
    <Query/>
   </queryOptions>
  </GetListItemChangesSinceToken> 
 </soap:Body>
</soap:Envelope>

The server responds with a GetListItemChangesSinceTokenResponse containing the three rows just added as follows:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <soap:Body>
  <GetListItemChangesSinceTokenResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <GetListItemChangesSinceTokenResult>
    <listitems MinTimeBetweenSyncs='0' RecommendedTimeBetweenSyncs='180' MaxBulkDocumentSyncSize='500' AlternateUrls='http://www.tailspintoys.com/' EffectivePermMask='FullMask' xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
     xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
     xmlns:rs='urn:schemas-microsoft-com:rowset'
     xmlns:z='#RowsetSchema'>
     <Changes LastChangeToken="1;3;7ffc2f13-9163-4e9f-bf4e-a3f34d882e8f;633386995628530000;803">
     </Changes>
     <rs:data ItemCount="3">
      <z:row ows_ID='1' ows_Title='Red' ows_MetaInfo='1;#' ows__ModerationStatus='0' ows__Level='1' ows_owshiddenversion='1' ows_UniqueId='1;#{DC043241-B825-4B59-8A77-ED4C3F71B186}' ows_FSObjType='1;#0' ows_Created='2008-02-14 16:13:02' ows_FileRef='1;#Lists/ListOfColors/1_.000' />
      <z:row ows_ID='2' ows_Title='Blue' ows_MetaInfo='2;#' ows__ModerationStatus='0' ows__Level='1' ows_owshiddenversion='1' ows_UniqueId='2;#{6445B756-366D-4527-AF2B-31199DAA4D36}' ows_FSObjType='2;#0' ows_Created='2008-02-14 16:13:02' ows_FileRef='2;#Lists/ListOfColors/2_.000' />
      <z:row ows_ID='3' ows_Title='Green' ows_MetaInfo='3;#' ows__ModerationStatus='0' ows__Level='1' ows_owshiddenversion='1' ows_UniqueId='3;#{1ADFAB90-5569-4CEC-BB73-39D43720AC51}' ows_FSObjType='3;#0' ows_Created='2008-02-14 16:13:02' ows_FileRef='3;#Lists/ListOfColors/3_.000' />
     </rs:data>
    </listitems>
   </GetListItemChangesSinceTokenResult>
  </GetListItemChangesSinceTokenResponse>
 </soap:Body>
</soap:Envelope>
Show:
© 2015 Microsoft