Webs.GetListTemplates Method

Returns the collection of list template definitions for the current site.

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

Syntax

<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetListTemplates", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function GetListTemplates As XmlNode

Dim instance As Webs
Dim returnValue As XmlNode

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

Return Value

A fragment in Collaborative Application Markup Language (CAML) in the following form, which can be assigned to a System.Xml.XmlNode object.

<ListTemplates xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <ListTemplate Name="custlist" DisplayName="Custom List" Type="100" 
      BaseType="0" OnQuickLaunch="TRUE" 
      SecurityBits="11" Description="Create a custom list when you want 
      to specify your own columns. The list opens as a Web page and 
      lets you add or edit items one at a time." 
      Image="/_layouts/images/itgen.gif" />
   <ListTemplate Name="gridlist" DisplayName="Custom List in 
      Datasheet View" Type="120" BaseType="0" 
      OnQuickLaunch="TRUE" SecurityBits="11" Description="Create a 
      custom list when you want to specify your own columns. The list 
      opens in a spreadsheet-like environment for convenient data 
      entry, editing, and formatting. It requires a Windows SharePoint 
      Services-compatible list datasheet control and ActiveX 
      control support." Image="/_layouts/images/itdatash.gif" />
   <ListTemplate Name="doclib" DisplayName="Document Library" 
      Type="101" BaseType="1" 
      OnQuickLaunch="TRUE" SecurityBits="11" Description="Create a 
      document library when you have a collection of documents or other 
      files that you want to share. Document libraries support features 
      such as subfolders, file versioning, and check-in/check-out." 
      Image="/_layouts/images/itdl.gif" DocumentTemplate="101" />
      .
      .
      .
</ListTemplates>

Example

The following code example displays the titles of list definitions whose base type is 0 (the generic list type). This example requires that a using (Visual C#) or Imports (Visual Basic) directive be included for the System.Xml namespace.

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

Dim strMessage As String = ""

Dim myNode As XmlNode = websService.GetListTemplates()

Dim nodes As XmlNodeList = myNode.SelectNodes("*[@BaseType=0]")

Dim node As XmlNode

For Each node In  nodes

    strMessage = strMessage + node.Attributes("Name").Value + ControlChars.Lf

Next node

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

string strMessage = "";

XmlNode myNode = websService.GetListTemplates();

XmlNodeList nodes = myNode.SelectNodes("*[@BaseType=0]");

foreach (XmlNode node in nodes)
{
    strMessage = strMessage + node.Attributes["Name"].Value + "\n";
}

MessageBox.Show(strMessage);

See Also

Reference

Webs Class
Webs Members
Webs Web Service