次の方法で共有


SPCustomWebTemplate Class

Represents a custom site template.

Inheritance Hierarchy

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

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

Syntax

<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPCustomWebTemplate _
    Inherits SPWebTemplate

Dim instance As SPCustomWebTemplate
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPCustomWebTemplate : SPWebTemplate

Remarks

You create a custom site template (.stp file) when you save a site as a template in the user interface or through the object model by using SaveAsTemplate() method.

Custom site 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 custom site template, an SPCustomWebTemplate always represents a custom site template.

Use the GetCustomWebTemplates method of the SPSite class to return the collection of site templates created through the user interface or the object model. After you have a reference to a collection, use an indexer to return a single 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 template.

A site template is defined in a manifest.xml file that is compressed into the .stp file. The file is stored in the SharePoint database. (An .stp 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