Export (0) Print
Expand All

SPCustomWebTemplate class

Represents a Web template.

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

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

public sealed class SPCustomWebTemplate : SPWebTemplate

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.

NoteNote

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.)

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