Share via


ApplyWebTemplate(String) Method

The ApplyWebTemplate method of the SPWeb class applies the specified site definition or site template to the Web site that has no template applied to it.

Parameters

strWebTemplate   A string that contains name of the site definition or the file name of the site template, including the .stp extension.

Example

The following code example applies a specified site template to a subsite in the current site collection.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security