Partilhar via


SPCustomWebTemplate Class

Represents a Web template.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.SPWebTemplate
    Microsoft.SharePoint.SPCustomWebTemplate

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<SubsetCallableTypeAttribute> _
Public NotInheritable Class SPCustomWebTemplate _
    Inherits SPWebTemplate
'Usage
Dim instance As SPCustomWebTemplate
[SubsetCallableTypeAttribute]
public sealed class SPCustomWebTemplate : SPWebTemplate

Remarks

You create a Web template (.wsp file) when you save a site as a template in the user interface or through the object model by using SaveAsTemplate() method. You can also manually create the contents of the .wsp package, file-by-file.

Web templates are one of two kinds of foundational entities that can be used to create sites. The other kind is site definition configuration.

Note

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

Use the GetCustomWebTemplates method of the SPSite class to return the collection of Web templates. After you have a reference to a collection, use an indexer to return a single Web template. For example, if the collection is assigned to a variable named myWebTemplates, use myWebTemplates[index] in Microsoft Visual C#, or myWebTemplates(index) in Microsoft Visual Basic, where index is either the title or the index number in the collection of the Web template.

A Web template is defined by a set of files that are compressed into the .wsp file. The most important of these files are an elements.xml file that contains a WebTemplate Element (Web Template) element and an Onet.xml file. The .wsp file is stored in the SharePoint Foundation database. (An .wsp file is a CAB file. You can open it in Windows Explorer if you first change the extension to .cab.)

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

SPCustomWebTemplate Members

Microsoft.SharePoint Namespace