Compartilhar via


SPWebTemplate Class

The SPWebTemplate class represents a site definition or a site template that is used to instantiate a SharePoint site. Site definitions are contained in files within Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60, while site templates are created through the user interface or through the object model when a site is saved as a template.

System.Object

   Microsoft.SharePoint.SPWebTemplate

Public Fields

The following table shows the public fields of the SPWebTemplate class and a brief description of each.

Name Description
WebTemplateMWS Specifies the default site definition used for a Meetings Workspace site.
WebTemplateSTS Specifies the default site definition used for a SharePoint site.

Public Properties

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

Name Data Type Description
Description String Gets the description for the site definition or site template.
ID Int32 Gets the ID for the site definition or site template.
ImageUrl String Gets the URL for the image that is used to represent the site definition or site template in the user interface.
IsCustomTemplate Boolean Gets a Boolean value that indicates whether the SPWebTemplate object is a site template.
IsHidden Boolean Gets a Boolean value that indicates whether the site definition or site template is displayed as an option for creating a site collection on the Template Selection page.
IsUnique Boolean Gets a Boolean value that indicates whether the site created from the site definition or site template inherits from its parent Web site.
Name String Gets the name of the site definition or site template.
Title String Gets the display name for the site definition or site template.

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 WebTemplate property of the SPWeb class to return the site definition used in the SharePoint site. Otherwise, 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 either the SPVirtualServer class or the SPSite class to return the collection of site definitions on the virtual server or in the 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