Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Thursday, January 31, 2013

Updating More Than one Record using Batch in Jquery And SharePoint Default WebServices

Please go to this post to understand what  JS files you need to download to achieve the required functionality.
 
var strSiteUrl = "http://SPSERVER:100";
var objList = new SPAPI_Lists(strSiteUrl);

var strBatch="";
    strBatch+="<Batch PreCalc='TRUE' OnError='Continue'>";
    strBatch+="<Method ID='1' Cmd='Update'>";
    strBatch+="<Field Name='ID'>1</Field>";
    strBatch+="<Field Name='Title'>Sample Batch Testing1</Field>";
    strBatch+="<Field Name='Country'>1</Field>";
    strBatch+="<Field Name='Gender'>Male</Field>";
    strBatch+="</Method>";
    strBatch+="<Method ID='2' Cmd='Update'>";
    strBatch+="<Field Name='ID'>2</Field>";
    strBatch+="<Field Name='Title'>Sample Batch Testing2</Field>";
    strBatch+="<Field Name='Country'>2</Field>";
    strBatch+="<Field Name='Gender'>Female</Field>";
    strBatch+="</Method>";
    strBatch+="<Method ID='3' Cmd='Update'>";
    strBatch+="<Field Name='ID'>3</Field>";
    strBatch+="<Field Name='Title'>Sample Batch Testing3</Field>";
    strBatch+="<Field Name='Country'>3</Field>";
    strBatch+="<Field Name='Gender'>Male</Field>";
    strBatch+="</Method>";
    strBatch+="</Batch>";
   
     var res=objList.updateListItems("JWS Practice",strBatch);
     if(res.status==200)
     {
        alert('Records Updated Successfully');
     }

No comments:

Post a Comment