Thursday, August 16, 2012

Batch Update for Insert the records into a list

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

for (var i = 0; i < subCategory.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 res = oLists.updateListItems("lstDocOrder", query);

No comments:

Post a Comment