Tuesday, December 8, 2009

Update Sharepoint list using javascript

function CreateListItem(lstName,updateXML,wsURL,action)
{
var oXMLHttpRequest;
try
{
oXMLHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
alert("XMLHttpRequest not supported");
}


var soapEnv = '<?xml version="1.0" encoding="utf-8"?>';
soapEnv += '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ';
soapEnv += 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
soapEnv += '<soap:Body><UpdateListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">';
soapEnv += '<listName>'+lstName+'</listName><updates>'+updateXML+'</updates></UpdateListItems></soap:Body></soap:Envelope>';

oXMLHttpRequest.open("POST", wsURL, false);
oXMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
oXMLHttpRequest.setRequestHeader("SOAPAction", action);

oXMLHttpRequest.send(soapEnv);

alert(oXMLHttpRequest.status);

}

function updateList()
{
var updateXML = stringNode= "<Batch OnError='Continue'>";
updateXML+= "<Method ID='1' Cmd='Update'>";
updateXML+= "<Field Name='ID'><![CDATA[374]]></Field>";
updateXML+= "<Field Name='Title'><![CDATA[555]]>";
updateXML+= "</Field></Method></Batch>";
CreateListItem('ListName',updateXML,'http://siteURL/_vti_bin/Lists.asmx','http://schemas.microsoft.com/sharepoint/soap/UpdateListItems');
}

Tuesday, December 1, 2009

Site restoration using SPD

Steps to restore site from SPD
1. Open the site in the Sharepoint designer which you want to backup
2. Click on Site Tab -> Administration -> Backup Web Site
3. Click on the Advanced Button to verify if the site URL is corrected
4. If you want to put the Subsite in the archival, select the Checkbox
5. Save the .cmp file in the local system
6. Create a blank site
7. Open the newly created site in the SPD
8. Click on Site Tab -> Administration -> Restore Web Site
9. Click on the Advanced Button to verify if the site URL is corrected
10.Click ok to restore the site.