Webs.GetWeb Method (Webs)
Returns properties of a site (for example, name, description, and theme).

Web Service: WebsWeb Reference: http://<Site>/_vti_bin/Webs.asmx
Syntax

Visual Basic (Declaration)
<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetWeb", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function GetWeb ( _
    webUrl As String _
) As XmlNode
Visual Basic (Usage)
Dim instance As Webs
Dim webUrl As String
Dim returnValue As XmlNode

returnValue = instance.GetWeb(webUrl)
C#
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetWeb", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public XmlNode GetWeb (
    string webUrl
)

Parameters

webUrl

A string that contains the absolute URL of the site. To return information about the current site, a period (".") can be passed as the value of this parameter.

Return Value

An XML fragment in the following form that can be assigned to a System.Xml.XmlNode object.
Xml
<Web Title="Site_Name" Url=
   "http://Server_Name/sites/Site_Name/Subsite_Name" 
   Description="Description" Language="1033" Theme="Theme" 
   xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
Example

The following code example displays the title of the specified site. This example requires that a using (Visual C#) or Imports (Visual Basic) directive be included for the System.Xml namespace.

Visual Basic
Dim websService As New Web_Reference_Folder_Name.Webs()
websService.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim myNode As XmlNode = websService.GetWeb("http://Server_Name/sites/Site_Name/Subsite_Name")

Dim strMessage As String = myNode.Attributes("Title").Value

MessageBox.Show(strMessage)
C#
Web_Reference_Folder_Name.Webs websService = new Web_Reference_Folder_Name.Webs();
websService.Credentials= System.Net.CredentialCache.DefaultCredentials;

XmlNode myNode = websService.GetWeb("http://Server_Name/sites/Site_Name/Subsite_Name");

string strMessage = myNode.Attributes["Title"].Value;

MessageBox.Show(strMessage);
See Also

Tags :


Page view tracker