Sample Code for SiteDataGetWeb

Aug 24, 2012 at 1:47 PM

Needed to use it to snag the WebID for use in a different call.

$().SPServices({
     operation: "SiteDataGetWeb",
     async:false,	
     webURL: "/MySiteRelativeWebUrl",
     completefunc: function (xData, Status){
         //To show full return, create a div with the id of xmlMe
         //$("#xmlMe").text(xData.responseXML.xml);	
         if(Status="Success"){
    	var myWebId = $(xData.responseXML).find("WebID").text();    				
    	//returns full GUID with brackets which can then be used with 'GetListItems'    				
        }
        else{
	alert("Status of web service call is " + Status + ". Please try a different site relative webURL." 				
        }				
    } //End complete function
});//end Services call	
Coordinator
Sep 11, 2012 at 1:13 PM

Thanks! I'll add it into the documentation.

M.

Feb 14, 2013 at 11:08 AM
Just need to close the alert statement:
$().SPServices({
     operation: "SiteDataGetWeb",
     async:false,   
     webURL: "/MySiteRelativeWebUrl",
     completefunc: function (xData, Status){
         //To show full return, create a div with the id of xmlMe
         //$("#xmlMe").text(xData.responseXML.xml); 
         if(Status="Success"){
        var myWebId = $(xData.responseXML).find("WebID").text();                    
        //returns full GUID with brackets which can then be used with 'GetListItems'                    
        }
        else{
    alert("Status of web service call is " + Status + ". Please try a different site relative webURL.");
        }               
    } //End complete function
});//end Services call  
Feb 14, 2013 at 11:14 AM
thanks! Good catch!
Coordinator
Feb 14, 2013 at 4:13 PM
Fixed in the docs as well.

M.