This documentation is archived and is not being maintained.

SPWeb.ApplyTheme Method

Windows SharePoint Services 3

Applies a theme to a Web site.

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

public void ApplyTheme(
	string strNewTheme


Type: System.String
A string that contains the template ID of a theme that is specified in the SPTHEMES.XML file of the \\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\Locale_ID folder.

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

using (SPWeb oWebsite = SPContext.Current.Site.OpenWeb("Website_URL"))

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Best Practices: Using Disposable Windows SharePoint Services Objects.