this is the code:
xmlDoc += "<Batch>";
xmlDoc += "<Method ID='1' Cmd='New'>";
xmlDoc += "<Field Name='ID'>" + idNode.text +"</Field>";
xmlDoc += "<Field Name='FirstName'>" + fnNode.text +"</Field>";
xmlDoc += "<Field Name='LastName'>" + lnNode.text +"</Field>";
xmlDoc += "</Method>";
xmlDoc += "</Batch>";
soapRequest += "<?xml version='1.0' encoding='utf-8'?>";
soapRequest += "<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/'>";
soapRequest += " <soap:Body>";
soapRequest += "
<xmlns='
http://schemas.microsoft.com/sharepoint/soap/'>";
soapRequest += " <listName>רשימת מבקרי×</listName>"; //Change
here the name of the list to update
soapRequest += " <updates>" + xmlDoc + "</updates>"; //Just
specify your Batch xml variable created before
soapRequest += " </UpdateListItems>";
soapRequest += " </soap:Body>";
soapRequest += "</soap:Envelope>";
//objXMLHttp. Just a nice try&catch to deal with eventual problems.
try
{
var xmlHttpRequest = new ActiveXObject("MSXML2.XMLHTTP.5.0");
}
catch(ex)
{
XDocument.UI.Alert("Could not create MSXML2.XMLHTTP.5.0
object.\r\n" + ex.number + " - " + ex.description);
return false;
}
xmlHttpRequest.open("POST", "
http://teutza/_vti_bin/Lists.asmx",
false);
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml;
charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length",1);
xmlHttpRequest.setRequestHeader("SOAPAction",
"
http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
xmlHttpRequest.send(soapRequest);
By the way. this Insert operation worked fine but now I get error of:
"The download of the specified resource has failed"
WHY?????????