Share via


GetWebCollection Method

The GetWebCollection method of the Webs service returns the titles and URLs of all sites directly beneath the current site.

Return Value

An XML fragment in the following form that can be assigned to a System.Xml.XmlNode object:

<Webs xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <Web Title="Subsite1_Name" Url="http://Server_Name/[sites]/[Site_Name]/[Subsite1]" />
   <Web Title="Subsite2_Name" Url="http://Server_Name/[sites]/[Site_Name]/[Subsite2]" />
</Webs>

Example

The following code example displays the titles of all the sites directly beneath the current site.

This example requires that a using (C#) or Imports (Visual Basic .NET) directive be included for the System.Xml namespace.

Requirements

Platforms: Microsoft Windows Server 2003

Web Reference: http://Server_Name/[sites/][Site_Name/]_vti_bin/Webs.asmx