Partager via


SPWebTemplateCollection Class

The SPWebTemplateCollection class represents a collection of SPWebTemplate objects.

System.Object

   Microsoft.SharePoint.SPBaseCollection

      Microsoft.SharePoint.SPWebTemplateCollection

Public Properties

The following table shows the public properties of the SPWebTemplateCollection class, the data type of each property, and a brief description of each.

Name Data Type Description
Count Int32 Gets the number of site definitions or site templates in the collection.
Item(Int32) Microsoft.SharePoint.SPWebTemplate Gets the site definition or site template object at the specified index in the collection.
Item(String) Microsoft.SharePoint.SPWebTemplate Gets the site definition or site template object with the specified name from the collection.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread safe.

Remarks

Use the GetCustomWebTemplates method of the SPSite class to return site templates created through the user interface or through the object model. Use the GetWebTemplates method of either the SPVirtualServer class or the SPSite class to return the collection of site definitions for the virtual server or site collection. Use an indexer to return a single site definition or site template from the collection. For example, if the collection is assigned to a variable named mySiteTemplates, use mySiteTemplates[index] in C#, or mySiteTemplates(index) in Visual Basic .NET, where index is either the title or the index number in the collection of the site definition or site template.

Requirements

Namespace: Microsoft.SharePoint

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security