Wednesday, March 2, 2016

Batch Command Update for Insert the records into a SharePoint list

var query = "<Batch OnError='Continue' RootFolder='" + RootFolder + "' ViewName=''>";

for (var i = 0; i < data.length - 1; i++)
{

 query += "<Method ID='1' Cmd='New'>";
        query += "<Field Name='Title'>" + DocTitle;
        query += "</Field>";
        query += "<Field Name='GrpTitle'>" + GrpTitle;
        query += "</Field>";
        query += "<Field Name='Category'>" + catID;
        query += "</Field>";
        query += "<Field Name='SubCat'>" + subCategory[i];
        query += "</Field>";
        query += "<Field Name='DispOrder'>" + DispOrder;
        query += "</Field>";
        query += "<Field Name='DocID'>" + DocID;
        query += "</Field>";
        query += "<Field Name='DocURL'>" + DocURL;
        query += "</Field>";
        query += "<Field Name='DocDesc'>" + DocDesc;
        query += "</Field>";
        query += "<Field Name='DocType'>" + DocType;
        query += "</Field>";
        query += "</Method>";

}
 query += "</Batch>";
var resf = oLists.updateListItems("lstDocOrder", query);

No comments:

Post a Comment