4.2 Use UpdateLists to Insert Items into a List

This example describes how to use UpdateLists method to insert list items into a list.

The protocol client sends the following message to the protocol server to insert a list item into a list:

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
     <UpdateLists xmlns="http://schemas.microsoft.com/office/Access/Server/WebServices/AccessServer/"> 
       <u cmd="i" ln="{3B6DEE82-D5AC-4ACE-A6E1-00774FA1E10F}" ut="0" id="0">
         <f n="JobTitle" v="Sales Representitive" />
       </u>
       <par>false</par>
     </UpdateLists> 
   </soap:Body>
 </soap:Envelope>

In the u element, as defined in section 3.1.4.8.3.1, the cmd attribute has the value "i", indicating that this is an insertion.

ln equals "{3B6DEE82-D5AC-4ACE-A6E1-00774FA1E10F}". In this example, this is the GUID of an existing list. The insertion happens to this list.

ut equals zero ("0"). This value is used to match the UpdateLists response with UpdateLists request. The ut value in the corresponding response for this particular UpdateLists request is also zero ("0").

In an insert command, the id attribute in the request is ignored on the protocol server. The protocol client in this example sends a zero ("0").

In this example, the protocol client requests to insert a list item that has one field, named "JobTitle" Therefore, there is an f element, as defined in section 2.2.4.1.

The protocol server responds with the following message:

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
     <UpdateListsResponse xmlns="http://schemas.microsoft.com/office/Access/Server/WebServices/AccessServer/">
       <UpdateListsResult>
         <mit xsi:nil="true" />
         <Update ec="0" em="" cmd="i" ut="0" ln="{3B6DEE82-D5AC-4ACE-A6E1-00774FA1E10F}" id="1">
           <f n="JobTitle" v=" Sales Representitive " />
           <f n="LinkTitleNoMenu" v="" />
           <f n="Editor" v="25;#Andrew Cencini" />
           <f n="Author" v="25;#Andrew Cencini " />
           <f n="Modified" v="05/11/2009 08:02:36" />
           <f n="Created" v="05/11/2009 08:02:36" />
           <f n="ID" v="5" />
           <f n="owshiddenversion" v="1" />
           <f n="Attachments" v="False" />
         </Update>
       </UpdateListsResult>
     </UpdateListsResponse>
   </soap:Body>
 </soap:Envelope>

In this example, the id attribute equals "1", meaning that the list item inserted has an identifier equal to "1" in the list. In subsequent UpdateLists calls, both the protocol client and the protocol server use an identifier equal to "1" to refer to this list item.