Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Webs.WebUrlFromPageUrl method

Returns the URL of the parent site for the specified page URL.

Namespace:  WebSvcWebs
Assembly:  STSSOAP (in STSSOAP.dll)
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/WebUrlFromPageUrl", RequestNamespace = "http://schemas.microsoft.com/sharepoint/soap/", 
	ResponseNamespace = "http://schemas.microsoft.com/sharepoint/soap/", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public string WebUrlFromPageUrl(
	string pageUrl
)

Parameters

pageUrl
Type: System.String

A string that contains the absolute URL of the page.

Return value

Type: System.String
A string that contains the site URL.

If the page URL is "http://Server_Name/Web_One/Web_Two/Web_Three/Lists/Events/Allitems.aspx", the WebUrlFromPageUrl method returns "http://Server_Name/Web_One/Web_Two/Web_Three". If the Web site does not exist on the server, the top-level site is returned.

The following code example displays the site URL for a specified page URL.

Web_Reference_Folder_Name.Webs webService = new Web_Reference_Folder_Name.Webs();
webService.Credentials= System.Net.CredentialCache.DefaultCredentials;

string strPageUrl = "http://Server_Name/sites/Site_Name/Lists/Events/AllItems.aspx";

string strSiteUrl = webService.WebUrlFromPageUrl(strPageUrl);

MessageBox.Show(strSiteUrl);
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.