1

I'm trying to update list data on Sharepoint via HTML web part. This is my update function:

  function UpdateListItems( ids ) {

    var response = getNode( 
        '<?xml version="1.0" encoding="utf-8"?>' +
        '<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">' +
        '<soap12:Body>' +
           '<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">' +
                  '<listName>' + wikiLibrary + '</listName>' +
                  '<updates>' +
                     '<Batch OnError="Continue" ListVersion="1">' 
                        + ids +
                     '</Batch>' +
                  '</updates>' +
               '</UpdateListItems>' +
        '</soap12:Body>' +
        '</soap12:Envelope>'
        );
 alert( response.xml );

}

This results into this error:

0x8102000aInvalid URL Parameter. The URL provided containes an invalid Command or Value. Please check URL again

Any help will be highly appreciated!

1

the problem was solved by targeting list items in getListItems function -

               k++;
               batchstring = batchstring + '<Method ID="' + k + '" Cmd="Update">';
               batchstring = batchstring + '<Field Name="ID">' + data.childNodes[i].attributes[j].value + '</Field>';
               batchstring = batchstring + '<Field Name="Date">' + dag + '</Field></Method>';

the batchstring = batchstring + '<Field Name="ID">' + data.childNodes[i].attributes[j].value + '</Field>'; was changed from batchstring = batchstring + '<Field Name="ows_ID">' + data.childNodes[i].attributes[j].value + '</Field>';

1

Include Method and Field command inside batch command.

below is example,

 function UpdateListItems( ids ) {

var response = getNode( 
    '<?xml version="1.0" encoding="utf-8"?>' +
    '<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">' +
    '<soap12:Body>' +
       '<UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">' +
              '<listName>' + wikiLibrary + '</listName>' +
              '<updates>' +
                 '<Batch OnError="Continue" ListVersion="1">' 
                  '<Method ID='+ ids + 'Cmd="Update">'+
                     '<Field Name="ID" >'+ids+'</Field>'+
                   ' </Method> '+
                 '</Batch>' +
              '</updates>' +
           '</UpdateListItems>' +
    '</soap12:Body>' +
    '</soap12:Envelope>'
    );

alert( response.xml );

Refer this for batch commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.