Applies a theme to a Web site.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Visual Basic (Declaration)
Public Sub ApplyTheme ( _
strNewTheme As String _
)
Dim instance As SPWeb
Dim strNewTheme As String
instance.ApplyTheme(strNewTheme)
public void ApplyTheme (
string strNewTheme
)
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.
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
using (SPWeb oWebsite = SPContext.Current.Site.OpenWeb("Website_URL"))
{
oWebsite.ApplyTheme("Theme_ID");
}