SiteData.GetSiteAndWeb method

Returns the absolute URL of a subsite and the absolute URL of its top-level parent site based on the specified site URL.

Namespace:  WebSvcSiteData
Assembly:  STSSOAP (in STSSOAP.dll)

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetSiteAndWeb", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetSiteAndWeb ( _
    strUrl As String, _
    <OutAttribute> ByRef strSite As String, _
    <OutAttribute> ByRef strWeb As String _
) As UInteger
'Usage
Dim instance As SiteData
Dim strUrl As String
Dim strSite As String
Dim strWeb As String
Dim returnValue As UInteger

returnValue = instance.GetSiteAndWeb(strUrl, _
    strSite, strWeb)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetSiteAndWeb", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public uint GetSiteAndWeb(
    string strUrl,
    out string strSite,
    out string strWeb
)

Parameters

  • strUrl
    Type: System.String

    The absolute URL of the parent top-level site.

Return value

Type: System.UInt32
A 32-bit unsigned integer that returns 0 to indicate that the operation has completed.

Examples

The following code example displays the absolute URLs of a top-level site and a subsite. This example assumes the existence of a label within the form of a Windows Application.

Dim srvSiteData As New Web_Reference_Name.SiteData()
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim siteCollection As String
Dim site As String

srvSiteData.GetSiteAndWeb("http://Server_Name/sites/Site/Subsite", siteCollection, site)

label1.Text = siteCollection + " :: " + site
Web_Reference_Name.SiteData srvSiteData = new Web_Reference_Name.SiteData();
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials;

string siteCollection;
string site;

srvSiteData.GetSiteAndWeb("http://Server_Name/sites/Site/Subsite", 
    out siteCollection, out site); 

label1.Text = siteCollection + " :: " + site;

See also

Reference

SiteData class

SiteData members

WebSvcSiteData namespace