SPWeb.ApplyTheme Method (Microsoft.SharePoint) Home
SPWeb.ApplyTheme Method (Microsoft.SharePoint)
Applies a theme to a Web site.

Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Syntax

'Usage

Dim instance As SPWeb
Dim strNewTheme As String

instance.ApplyTheme(strNewTheme)

'Declaration

Public Sub ApplyTheme ( _
    strNewTheme As String _
)

Parameters

strNewTheme

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.

Example

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

Using webSite As SPWeb = SPContext.Current.Site.OpenWeb("Website_URL")
    webSite.ApplyTheme("Theme_ID")
End Using

NoteNote:

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.

See Also

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View