Thursday, August 16, 2012
Replace all the Special Characters in SharePoint
function CorrectStringAsSPData(strValue)
{
//Replace & symbol
var givenString = strValue.replace(/&/g, "&");
//Replace < symbol
givenString = givenString.replace(/</g, "<");
//Replace > symbol
givenString = givenString.replace(/>/g, ">");
//alert(givenString)
return givenString;
}
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);
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);
Subscribe to:
Posts (Atom)