Share via


Sites.GetSiteTemplates Method

Returns information about the collection of site definitions and sites templates in the Web application.

Namespace:  [Sites Web service]
Web service reference: http://Site/_vti_bin/Sites.asmx

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetSiteTemplates", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetSiteTemplates ( _
    LCID As UInteger, _
    <OutAttribute> ByRef TemplateList As Template() _
) As UInteger
'Usage
Dim instance As Sites
Dim LCID As UInteger
Dim TemplateList As Template()
Dim returnValue As UInteger

returnValue = instance.GetSiteTemplates(LCID, _
    TemplateList)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetSiteTemplates", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public uint GetSiteTemplates(
    uint LCID,
    out Template[] TemplateList
)

Parameters

  • LCID
    Type: System.UInt32

    A 32-bit integer that specifies the locale identifier (LCID), for example, 1033 in English.

  • TemplateList
    Type: []

    A template array whose elements provide fields containing information about each template.

Return Value

Type: System.UInt32
If successful, returns 0 as an unsigned integer.

Remarks

To access the Sites service and its methods, set a Web reference to https://Server_Name/[sites/][Site_Name/]_vti_bin/Sites.asmx.

Examples

The following code example displays information about all the site definitions and site templates in the Web application.

Dim siteService As New Web_Reference_Folder_Name.Sites()
siteService.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim strDisplay As String = ""
Dim templates() As Web_Reference_Folder_Name.Template
siteService.GetSiteTemplates(1033, templates)
Dim template As ProjectName.Web_Reference_Folder_Name.Template
For Each template In  templates
    strDisplay += "Title: " + template.Title + "  Name: " + template.Name + _
        "  Description: " + template.Description + "  IsCustom: " + template.IsCustom + _
        "  ID: " + template.ID + "  ImageUrl: " + template.ImageUrl + "  IsHidden: " + template.IsHidden + _
        "  IsUnique: " + template.IsUnique + ControlChars.Lf + ControlChars.Lf
Next template
MessageBox.Show(strDisplay)
Web_Reference_Folder_Name.Sites siteService = new Web_Reference_Folder_Name.Sites();
siteService.Credentials= System.Net.CredentialCache.DefaultCredentials;
string strDisplay = "";
Web_Reference_Folder_Name.Template[] templates;
siteService.GetSiteTemplates(1033, out templates);
foreach (Project_Name.Web_Reference_Folder_Name.Template template in templates)
{
    strDisplay += "Title: " + template.Title + "  Name: " + template.Name + 
        "  Description: " + template.Description + "  IsCustom: " + 
        template.IsCustom + "  ID: " + template.ID + "  ImageUrl: " + template.ImageUrl + 
        "  IsHidden: " + template.IsHidden + "  IsUnique: " + template.IsUnique + "\n\n";
}
MessageBox.Show(strDisplay);

See Also

Reference

Sites Class

Sites Members

Sites Web Service