SPWeb.ApplyTheme 方法 (String)
请注意:此 API 现在已过时。
Applies a theme to a website.
命名空间: Microsoft.SharePoint
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
<ObsoleteAttribute("This method applies to SharePoint 2007 theming and is no longer functional", _
False)> _
Public Sub ApplyTheme ( _
strNewTheme As String _
)
用法
Dim instance As SPWeb
Dim strNewTheme As String
instance.ApplyTheme(strNewTheme)
[ObsoleteAttribute("This method applies to SharePoint 2007 theming and is no longer functional",
false)]
public void ApplyTheme(
string strNewTheme
)
参数
strNewTheme
类型:System.StringThe template ID of the new theme that is specified in the SpThemes.xml file of the \\ProgramFiles\Common Files\Microsoft Shared\web server extensions\14\Template\Layouts\1033 folder.
备注
警告
Use this method only when the UI is in backward compatibility mode (SPWeb.UIVersion = 3).
This method sets the Theme property to the name of the theme specified by strNewTheme.
示例
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");
}
备注
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 Disposing Objects.