共用方式為


SPWebTemplateCollection Class

Represents a collection of SPWebTemplate objects.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.SPBaseCollection
      Microsoft.SharePoint.SPWebTemplateCollection

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public Class SPWebTemplateCollection _
    Inherits SPBaseCollection

Dim instance As SPWebTemplateCollection
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public class SPWebTemplateCollection : SPBaseCollection

Remarks

Use the GetCustomWebTemplates method of the SPSite class to return the collection of site templates created through the user interface or the object model, or use the GetWebTemplates method of the SPSite class to return the collection of site definition configurations in the site collection. After you have a reference to a collection, use an indexer to return a single site definition configuration or site template. For example, if the collection is assigned to a variable named mySiteTemplates, use mySiteTemplates[index] in Microsoft Visual C#, or mySiteTemplates(index) in Microsoft Visual Basic, where index is either the title or the index number in the collection of the site definition configuration or site template.

Thread Safety

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

See Also

Reference

SPWebTemplateCollection Members

Microsoft.SharePoint Namespace