Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have to fill in an ID when you call UpdateListItems. See the Cmd="New" example in <a href="http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems%28office.12%29.aspx" rel="nofollow">MSDN</a>.</p> <p>So in your case, change you Batch element to:</p> <pre><code>var batch = "&lt;Batch OnError=\"Continue\"&gt;&lt;Method ID=\"1\" Cmd=\"New\"&gt;" + "&lt;Field Name=\"Title\"&gt;" + title + "&lt;/Field&gt;" + "&lt;Field Name=\"ID\"&gt;" + New + "&lt;/Field&gt;" + "&lt;/Method&gt;&lt;/Batch&gt;"; </code></pre> <p>Where New is a made up ID. You still have to parse the result for the real ID, as you're already doing.</p> <p>Here's an example of a request to a SP2010 Server list:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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"&gt; &lt;soap:Body&gt; &lt;UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/"&gt; &lt;listName&gt;Announcements&lt;/listName&gt; &lt;updates&gt; &lt;Batch OnError="Continue"&gt; &lt;Method ID="1" Cmd="New"&gt; &lt;Field Name="ID"&gt;998877&lt;/Field&gt; &lt;Field Name="Title"&gt;abcdef&lt;/Field&gt; &lt;/Method&gt; &lt;/Batch&gt; &lt;/updates&gt; &lt;/UpdateListItems&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>And the response:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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"&gt; &lt;soap:Body&gt; &lt;UpdateListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"&gt; &lt;UpdateListItemsResult&gt; &lt;Results&gt; &lt;Result ID="1,New"&gt; &lt;ErrorCode&gt;0x00000000&lt;/ErrorCode&gt; &lt;ID /&gt; &lt;z:row ows_ID="6" details="removed" xmlns:z="#RowsetSchema" /&gt; &lt;/Result&gt; &lt;/Results&gt; &lt;/UpdateListItemsResult&gt; &lt;/UpdateListItemsResponse&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload