Represents a Web template.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
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.
While an SPWebTemplate can represent either a site definition configuration or a Web template, an 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.)