Export (0) Print
Expand All

SPWebTemplate Class

Windows SharePoint Services 3

Represents a site definition configuration or site template that is used to create SharePoint sites.

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

[UpgradableAttribute]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public class SPWebTemplate

Site definition configurations are contained in files within \\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE, while site templates are stored as .stp files in the SharePoint database.

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.

A site definition, which is a kind of container for one or more site definition configurations, is expressed, in Collaborative Application Markup Language (CAML) markup, by a <Template> element in a WebTemp*.xml file in the directory c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LCID\XML\, where LCID is the numeric ID of your language/culture such as 1033 for English. A site definition configuration is expressed by one of the child <Configuration> elements of the <Template> element. Details of the site definition configuration are stored in one of the <Configuration> elements in the Onet.xml file in the directory c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\site_type\XML\, where site_type is "STS," "MPS," "BLOG," "WIKI," "CENTRALADMIN," or the name of a custom site definition.

A site template is defined in a manifest.xml file that is compressed into the .stp file. (An .stp file is a CAB file. You can open it in Windows Explorer if you first change the extension to .cab.)

NoteNote

While an SPWebTemplate can represent either a site definition configuration or a custom site template, an SPCustomWebTemplate always represents a custom site template.

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

Community Additions

ADD
Show:
© 2014 Microsoft