sotona has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I need to read and write data from and to my SharePoint site. There is no problem in reading, but when I try to update some entry, I get the following error:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http: +//schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/20 +01/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <UpdateListItemsResponse xmlns="http://schemas.microsoft.com/sharepo +int/soap/"> <UpdateListItemsResult> <Results> <Result ID="1,Update"> <ErrorCode>0x81020026</ErrorCode> <ErrorText>LIst does not exist</ErrorText> </Result> </Results> </UpdateListItemsResult> </UpdateListItemsResponse> </soap:Body> </soap:Envelope>
my code is :
use LWP::UserAgent; use LWP::Debug; use SOAP::Lite on_action => sub { "$_[0]$_[1]"; }; import SOAP::Data qw(name value); # blablabla my $f_id = name('Field', 3469)->attr({Name => 'ID'}); my $f_title = name('Field','new_dummy')->attr({Name => 'Title'}); my $method = name('Method', [$f_id,$f_title])->attr({'ID' => '1', 'Cmd +' => 'Update'}); my $batch = name('Batch',\$method); my $updates = name('updates' => \$batch); my $rsp = $soap->UpdateListItems(name('listName' => '{DB8F7CAD-D459-46 +FD-82B8-5888A55C1EC2}'), $updates);
and it produces XML as suggested at MSDN.
Any ideas what do I do wrong?

Replies are listed 'Best First'.
Re: Problem updating SharePoint entries
by locked_user sundialsvc4 (Abbot) on Jan 22, 2015 at 13:26 UTC

    ... and it produces XML as suggested at MSDN.

    Prove it.   :-)   Show the exact XML that it produces, and likewise the exact response.   In both cases, a literal cut-and-paste (in code tags, of course) of the byte-for-byte messages.   I notice that in the response, the word is spelled LIst ... why?

      the exact XML is:
      <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http:/ +/www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSche +ma-instance"> <soap:Body> <UpdateListItems xmlns="http://schemas.microsoft.com/sharepoin +t/soap/"> <listName xsi:type="xsd:string">{DB8F7CAD-D459-46FD-82B8-5 +888A55C1EC2}</listName> <updates> <Batch> <Method Cmd="Update" ID="1" soapenc:arrayType="xsd +:anyType[2]" xsi:type="soapenc:Array"> <Field Name="ID" xsi:type="xsd:int">3469</Fiel +d> <Field Name="Title" xsi:type="xsd:string">more + dummy than ever</Field> </Method> </Batch> </updates> </UpdateListItems> </soap:Body> </soap:Envelope>
      and the exact response is (with sensitive data removed):
      <?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/s +harepoint/soap/"> <UpdateListItemsResult> <Results> <Result ID="1,Update"> <ErrorCode>0x81020026</ErrorCode> <ErrorText>&#1059;&#1082;&#1072;&#1079;&#1072; +&#1085;&#1085;&#1099;&#1081; &#1079;&#1076;&#1077;&#1089;&#1100; &#10 +89;&#1087;&#1080;&#1089;&#1086;&#1082; &#1073;&#1086;&#1083;&#1100;&# +1096;&#1077; &#1085;&#1077; &#1089;&#1091;&#1097;&#1077;&#1089;&#1090 +;&#1074;&#1091;&#1077;&#1090;.</ErrorText> <z:row ows_Title="dummy" ows_Mainline="_mainli +ne_" ows_Status="Compilation OK" ows_Windows_x0020_assembly="1" ows_L +inux_x0020_assembly="1" ows_Priority="Normal" ows__x041d__x0430__x043 +7__x0432__x04="30;#1009 (blablabla) " ows__x0421__x043e__x0437__x0434 +__x04="Do not create Setup" ows_Category="Plain Check" ows_Comment="d +ummy request for tests" ows__x0421__x0430__x043c__x043e__x040="Yes" o +ws__x0420__x0435__x0433__x0440__x04="No" ows_AS3D_x0020_Tests="0" ows +_AssignedTo="" ows_Is_Closed="0" ows_V3Comments="q" ows_ContentTypeId +="0x010300323E27C79E48AB499D539AE5B1B3385E" ows_LinkTitleNoMenu="dumm +y" ows_LinkTitleVersionNoMenu="dummy" ows_LinkTitle="dummy" ows_Edito +r="201;#Me" ows_ID="3469" ows_ContentType="&#1042;&#1086;&#1087;&#108 +8;&#1086;&#1089;" ows_Modified="2015-01-21 16:27:34" ows_Created="201 +5-01-21 16:27:21" ows_Author="201;#Me" ows_owshiddenversion="2" ows__ +UIVersion="1024" ows__UIVersionString="2.0" ows_Attachments="0" ows__ +ModerationStatus="0" ows_LinkTitle2="dummy" ows_SelectTitle="3469" ow +s_Order="346900.000000000" ows_GUID="{7F8A72A4-AA12-4B9B-AACA-5890BC3 +311B3}" ows_IssueID="3469" ows_IsCurrent="1" ows_FileRef="3469;#WorkF +low/Lists/Promote/3469_.000" ows_FileDirRef="3469;#WorkFlow/Lists/Pro +mote" ows_Last_x0020_Modified="3469;#2015-01-21 16:27:21" ows_Created +_x0020_Date="3469;#2015-01-21 16:27:21" ows_FSObjType="3469;#0" ows_S +ortBehavior="3469;#0" ows_PermMask="0x1b03c4312ef" ows_FileLeafRef="3 +469;#3469_.000" ows_UniqueId="3469;#{9515E15B-23CC-4ED1-8458-267D4814 +B2DD}" ows_ProgId="3469;#" ows_ScopeId="3469;#{4AC076F1-6A27-4066-B25 +2-7A1C94BFAB50}" ows__EditMenuTableStart="3469_.000" ows__EditMenuTab +leStart2="3469" ows__EditMenuTableEnd="3469" ows_LinkFilenameNoMenu=" +3469_.000" ows_LinkFilename="3469_.000" ows_LinkFilename2="3469_.000" + ows_ServerUrl="/WorkFlow/Lists/Promote/3469_.000" ows_EncodedAbsUrl= +"http://hostname/WorkFlow/Lists/Promote/3469_.000" ows_BaseName="3469 +_" ows_MetaInfo="3469;#" ows__Level="1" ows__IsCurrentVersion="1" ows +_ItemChildCount="3469;#0" ows_FolderChildCount="3469;#0" ows_LinkIssu +eIDNoMenu="3469" xmlns:z="#RowsetSchema" /> </Result> </Results> </UpdateListItemsResult> </UpdateListItemsResponse> </soap:Body> </soap:Envelope>
      as for misspelled "List" word: that's my translation of message wich actually should be "The list mentioned here doesn't exist anymore"