Create Folder Using Sharepoint Web service and javascript(out of box)

Sagarp
Posted by Sagarp under Others category on | Points: 40 | Views : 3247
if (window.XMLHttpRequest)
{


var ListName="Album";

var UpdateItemXml = "<Batch OnError='Continue' ListVersion='1'>"
+ "<Method ID=\"1\" Cmd=\"New\">"
+ "<Field Name=\"FSObjType\">1</Field>"
+ "<Field Name=\"BaseName\">"+ Name+"</Field>"
+"<Field Name=\"Title\">"+Name+"</Field>"
+ "</Method>"
+ "</Batch>";

if(a == null) return false;

a.open("POST",http://Serve:110/test/_layouts/_vti_bin/lists.asmx", false);

a.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

a.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");

var strSOAP1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ "<soap:Body>"
+ "<UpdateListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">"
+ "<listName>" + ListName + "</listName>"
+ "<updates>"+ UpdateItemXml + "</updates>"
+ "</UpdateListItems>"
+ "</soap:Body>"
+ "</soap:Envelope>";
a.send(strSOAP1);

}

Comments or Responses

Login to post response