Hi Marc,
Awesome library! Reading from lists with SPS is working great. But my first attempt at writing to a list is not turning out so hot. I wonder if you could help me diagnose the problem. It sure looks like I have everything set up correctly.
I am using UpdateListItems. After calling the function, a new item has indeed been added; I get a correct ID back. But back on the SP list, all of the fields are blank. The Title field has a standard "(no title)" text in it.
After unsuccessfully using an existing list, I made a basic custom list with just the Title field. The list is called SPServices. When using lists with more fields, all of those fields are blank as well.
I can enter a new item from the browser. I am a site collection admin, and permissions are all proper.
Here's the call:
$().SPServices({
operation: "UpdateListItems",
asynch: false,
batchCmd: "New",
listName: "SPServices",
valuePairs: [ ["Title", "JS Entry"] ],
completefunc: function(xData, Status){
r.append(Status+"...");
var newId = $(xData.responseXML).SPFilterNode("z:row").attr("ows_ID");
r.append("New ID : "+newId+"...");
},
debug: true
});
Here's the Request / Response traffic (slightly redacted:
==========
Webs.asmx
==========
Request Headers
Key Value
Request POST /_vti_bin/Webs.asmx HTTP/1.1
Accept application/xml, text/xml, */*; q=0.01
Content-Type text/xml;charset="utf-8"
X-Requested-With XMLHttpRequest
Referer https://domain.mil/sites/subsite/sps.htm
Accept-Language en-us
Accept-Encoding gzip, deflate
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0)
Host domain.mil
Content-Length 383
Connection Keep-Alive
Cache-Control no-cache
Cookie WSS_KeepSessionAuthenticated=443; MSOWebPartPage_AnonymousAccessCookie=443
Request Body
<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>
<WebUrlFromPageUrl xmlns='http://schemas.microsoft.com/sharepoint/soap/' >
<pageUrl>https://domain.mil/sites/subsite/sps.htm</pageUrl>
</WebUrlFromPageUrl>
</soap:Body>
</soap:Envelope>
Response Headers
Key Value
Response HTTP/1.1 200 OK
Cache-Control private, max-age=0
Content-Length 460
Content-Type text/xml; charset=utf-8
Server Microsoft-IIS/6.0
MicrosoftSharePointTeamServices 12.0.0.6550
X-Powered-By ASP.NET
X-AspNet-Version 2.0.50727
Date Tue, 20 Nov 2012 11:09:58 GMT
Response Body
<?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>
<WebUrlFromPageUrlResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<WebUrlFromPageUrlResult>https://domain.mil/sites/subsite</WebUrlFromPageUrlResult>
</WebUrlFromPageUrlResponse>
</soap:Body>
</soap:Envelope>
==========
Lists.asmx
==========
Request Headers
Key Value
Request POST /sites/subsite/_vti_bin/Lists.asmx HTTP/1.1
Accept application/xml, text/xml, */*; q=0.01
Content-Type text/xml;charset='utf-8'
SOAPAction http://schemas.microsoft.com/sharepoint/soap/UpdateListItems
X-Requested-With XMLHttpRequest
Referer https://domain.usmc.mil/sites/subsite/sps.htm
Accept-Language en-us
Accept-Encoding gzip, deflate
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0)
Host domain.mil
Content-Length 415
Connection Keep-Alive
Cache-Control no-cache
Request Body
<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>SPServices</listName>
<updates>
<Batch OnError='Continue'>
<Method ID='1' Cmd='New'></Method>
</Batch>
</updates>
</UpdateListItems>
</soap:Body>
</soap:Envelope>
Response Headers
Key Value
Response HTTP/1.1 200 OK
Cache-Control private, max-age=0
Content-Length 1802
Content-Type text/xml; charset=utf-8
Server Microsoft-IIS/6.0
MicrosoftSharePointTeamServices 12.0.0.6550
X-Powered-By ASP.NET
X-AspNet-Version 2.0.50727
Date Tue, 20 Nov 2012 11:09:59 GMT
Response Body
<?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="12" ows_ContentTypeId="0x0100449D605E99E81F43837C4964549392A2"
ows_ContentType="Item" ows_Modified="2012-11-20 05:09:59" ows_Created="2012-11-20 05:09:59"
ows_Author="44;#Doe LtCol John J" ows_Editor="44;#Doe LtCol John J"
ows_owshiddenversion="1" ows_WorkflowVersion="1" ows__UIVersion="512" ows__UIVersionString="1.0"
ows_Attachments="0" ows__ModerationStatus="0"
ows_SelectTitle="12" ows_Order="1200.00000000000"
ows_GUID="{BDD70366-11E8-40CC-B057-3996041D8791}"
ows_FileRef="12;#sites/subsite/Lists/SPServices/12_.000" ows_FileDirRef="12;#sites/subsite/Lists/SPServices"
ows_Last_x0020_Modified="12;#2012-11-20 05:09:59"
ows_Created_x0020_Date="12;#2012-11-20 05:09:59" ows_FSObjType="12;#0" ows_PermMask="0x7fffffffffffffff"
ows_FileLeafRef="12;#12_.000"
ows_UniqueId="12;#{7CC88A51-8A69-4955-BD69-8838A28B48B7}"
ows_ProgId="12;#"
ows_ScopeId="12;#{11C9F797-9460-4544-B21C-8A1F6B2848E2}"
ows__EditMenuTableStart="12_.000" ows__EditMenuTableEnd="12" ows_LinkFilenameNoMenu="12_.000"
ows_LinkFilename="12_.000" ows_ServerUrl="/sites/subsite/Lists/SPServices/12_.000"
ows_EncodedAbsUrl="https://domain.mil/sites/subsite/Lists/SPServices/12_.000"
ows_BaseName="12_" ows_MetaInfo="12;#" ows__Level="1" ows__IsCurrentVersion="1"
xmlns:z="#RowsetSchema" />
</Result>
</Results>
</UpdateListItemsResult>
</UpdateListItemsResponse>
</soap:Body>
</soap:Envelope>
Sorry for the length of the comment, but you probably would want this for diagnosis. This is an awesome library..if I can get it to write back!! I'd like to make EXTENSIVE use of it.
Thanks in advance,
Ed
↧