Class BrandingExtensions
Class that deals with branding features
Inheritance
Namespace: Microsoft.SharePoint.Client
Assembly: PnP.Framework.dll
Syntax
public static class BrandingExtensions : object
Methods
AllowAllPageLayouts(Web)
Allow the web to use all available page layouts
Declaration
public static void AllowAllPageLayouts(this Web web)
Parameters
Web
web
Web to operate against |
ClearAvailableWebTemplates(Web)
Can be used to remote filters from the available web template
Declaration
public static void ClearAvailableWebTemplates(this Web web)
Parameters
Web
web
Web to process |
ComposedLookExists(Web, String)
Checks if a composed look exists.
Declaration
public static bool ComposedLookExists(this Web web, string composedLookName)
Parameters
Web
web
Web to check |
System. Name of the composed look |
Returns
System. true if it exists; otherwise false |
CreateComposedLookByName(Web, String, String, String, String, String, Int32, Boolean)
Creates (or updates) a composed look in the web site; usually this is done in the root site of the collection.
Declaration
public static void CreateComposedLookByName(this Web web, string lookName, string paletteFileName, string fontFileName, string backgroundFileName, string masterFileName, int displayOrder = 1, bool replaceContent = true)
Parameters
Web
web
Web to create the composed look in |
System. Name of the theme |
System. File name of the palette file in the theme catalog of the site collection; path component ignored. |
System. File name of the font file in the theme catalog of the site collection; path component ignored. |
System. File name of the background image file in the theme catalog of the site collection; path component ignored. |
System. File name of the master page in the mastepage catalog of the web site; path component ignored. |
System. Display order of the composed look |
System. Replace composed look if it already exists (default true) |
CreateComposedLookByUrl(Web, String, String, String, String, String, Int32, Boolean)
Creates (or updates) a composed look in the web site; usually this is done in the root site of the collection.
Declaration
public static void CreateComposedLookByUrl(this Web web, string lookName, string paletteServerRelativeUrl, string fontServerRelativeUrl, string backgroundServerRelativeUrl, string masterServerRelativeUrl, int displayOrder = 1, bool replaceContent = true)
Parameters
Web
web
Web to create the composed look in |
System. Name of the theme |
System. URL of the palette file, usually in the theme catalog of the site collection |
System. URL of the font file, usually in the theme catalog of the site collection |
System. URL of the background image file, usually in /_layouts/15/images |
System. URL of the master page, usually in the masterpage catalog of the web site |
System. Display order of the composed look |
System. Replace composed look if it already exists (default true) |
DeployHtmlPageLayout(Web, String, String, String, String, String)
Can be used to deploy html page layouts to master page gallery.
Declaration
public static void DeployHtmlPageLayout(this Web web, string sourceFilePath, string title, string description, string associatedContentTypeID, string folderHierarchy = "")
Parameters
Web
web
Web as the root site of the publishing site collection |
System. Full path to the file which will be uploaded |
System. Title for the page layout |
System. Description for the page layout |
System. Associated content type ID |
System. Folder hierarchy where the html page layouts will be deployed |
DeployMasterPage(Web, String, String, String, String, String, String)
Deploys a new masterpage
Declaration
public static File DeployMasterPage(this Web web, string sourceFilePath, string title, string description, string uiVersion = "15", string defaultCSSFile = "", string folderPath = "")
Parameters
Web
web
The web to process |
System. The path to the source file |
System. The title of the masterpage |
System. The description of the masterpage |
System. UIVersion of the masterpage |
System. DefaultCSSFile of the masterpage |
System. FolderPath of the masterpage |
Returns
File
|
DeployPageLayout(Web, String, String, String, String, String)
Can be used to deploy page layouts to master page gallery.
Declaration
public static void DeployPageLayout(this Web web, string sourceFilePath, string title, string description, string associatedContentTypeID, string folderHierarchy = "")
Parameters
Web
web
Web as the root site of the publishing site collection |
System. Full path to the file which will be uploaded |
System. Title for the page layout |
System. Description for the page layout |
System. Associated content type ID |
System. Folder hierarchy where the page layouts will be deployed |
DisableReponsiveUI(Site)
Disables the Responsive UI on a Classic SharePoint Site
Declaration
public static void DisableReponsiveUI(this Site site)
Parameters
Site
site
The Site to disable the Responsive UI on |
DisableReponsiveUI(Web)
Disables the Responsive UI on a Classic SharePoint Web
Declaration
public static void DisableReponsiveUI(this Web web)
Parameters
Web
web
The Web to disable the Responsive UI on |
DisableResponsiveUI(Site)
Disables the Responsive UI on a Classic SharePoint Site
Declaration
public static void DisableResponsiveUI(this Site site)
Parameters
Site
site
The Site to disable the Responsive UI on |
DisableResponsiveUI(Web)
Disables the Responsive UI on a Classic SharePoint Web
Declaration
public static void DisableResponsiveUI(this Web web)
Parameters
Web
web
The Web to disable the Responsive UI on |
GetComposedLook(Web, String)
Returns the named composed look from the web gallery
Declaration
public static ThemeEntity GetComposedLook(this Web web, string composedLookName)
Parameters
Web
web
Web to check |
System. Name of the composed look to retrieve |
Returns
Theme Entity with the attributes of the composed look, or null if the composed look does not exists or cannot be determined |
GetCurrentComposedLook(Web)
Returns the current theme of a web
Declaration
public static ThemeEntity GetCurrentComposedLook(this Web web)
Parameters
Web
web
Web to check |
Returns
Theme Entity with attributes of current composed look, or null if none |
GetPageLayoutListItemByName(Web, String)
Gets a page layout from the master page catalog. Can be called with paramter as "pagelayout.aspx" or as full path like "_catalog/masterpage/pagelayout.aspx"
Declaration
public static ListItem GetPageLayoutListItemByName(this Web web, string pageLayoutName)
Parameters
Web
web
root web |
System. name of the page layout to retrieve |
Returns
List ListItem holding the page layout, null if not found |
GetRelativeUrlForMasterByName(Web, String)
Returns the relative URL for a masterpage
Declaration
public static string GetRelativeUrlForMasterByName(this Web web, string masterPageName)
Parameters
Web
web
Web to process |
System. The name of the masterpage, e.g. 'default' or 'seattle' |
Returns
System.
|
SetAvailablePageLayouts(Web, Web, IEnumerable<String>)
Sets the available page layouts
Declaration
public static void SetAvailablePageLayouts(this Web web, Web rootWeb, IEnumerable<string> pageLayouts)
Parameters
Web
web
The web to process |
Web
rootWeb
The rootweb |
IEnumerable<System. The page layouts to make available |
SetAvailableWebTemplates(Web, List<WebTemplateEntity>)
Defines which templates are available for subsite creation
Declaration
public static void SetAvailableWebTemplates(this Web web, List<WebTemplateEntity> availableTemplates)
Parameters
Web
web
Web to operate against |
List<Web List of Web |
SetComposedLookByUrl(Web, String, String, String, String, String, Boolean, Boolean)
Retrieves the named composed look, overrides with specified palette, font, background and master page, and then recursively sets the specified values.
Declaration
public static void SetComposedLookByUrl(this Web web, string lookName, string paletteServerRelativeUrl = null, string fontServerRelativeUrl = null, string backgroundServerRelativeUrl = null, string masterServerRelativeUrl = null, bool resetSubsitesToInherit = false, bool updateRootOnly = true)
Parameters
Web
web
Web to apply composed look to |
System. Name of the composed look to apply; null will apply the override values only |
System. Override palette file URL to use |
System. Override font file URL to use |
System. Override background image file URL to use |
System. Override master page file URL to use |
System. false (default) to apply to currently inheriting subsites only; true to force all subsites to inherit |
System. false to apply to subsites; true (default) to only apply to specified site |
SetCustomMasterPageByName(Web, String)
Master page is set by using master page name. Master page is set from the current web.
Declaration
public static void SetCustomMasterPageByName(this Web web, string masterPageName)
Parameters
Web
web
Current web |
System. Name of the master page. Path is resolved from this. |
SetCustomMasterPageByUrl(Web, String, Boolean, Boolean)
Set Custom master page by using given URL as parameter. Suitable for example in cases where you want sub sites to reference root site master page gallery. This is typical with publishing sites.
Declaration
public static void SetCustomMasterPageByUrl(this Web web, string masterPageServerRelativeUrl, bool resetSubsitesToInherit = false, bool updateRootOnly = false)
Parameters
Web
web
Context web |
System. URL to the master page. |
System. false (default) to apply to currently inheriting subsites only; true to force all subsites to inherit |
System. false (default) to apply to subsites; true to only apply to specified site |
SetDefaultPageLayoutForSite(Web, Web, String)
Sets specific page layout the default page layout for the particular site
Declaration
public static void SetDefaultPageLayoutForSite(this Web web, Web rootWeb, string pageLayoutName)
Parameters
Web
web
Web to process |
Web
rootWeb
The rootWeb |
System. Name of the page layout |
SetHomePage(Web, String)
Sets the web home page
Declaration
public static void SetHomePage(this Web web, string rootFolderRelativePath)
Parameters
Web
web
The Web to process |
System. The path relative to the root folder of the site, e.g. SitePages/Home.aspx |
SetMasterPageByName(Web, String)
Master page is set by using master page name. Master page is set from the current web.
Declaration
public static void SetMasterPageByName(this Web web, string masterPageName)
Parameters
Web
web
Current web |
System. Name of the master page. Path is resolved from this. |
SetMasterPageByUrl(Web, String, Boolean, Boolean)
Set master page by using given URL as parameter. Suitable for example in cases where you want sub sites to reference root site master page gallery. This is typical with publishing sites.
Declaration
public static void SetMasterPageByUrl(this Web web, string masterPageServerRelativeUrl, bool resetSubsitesToInherit = false, bool updateRootOnly = false)
Parameters
Web
web
Context web |
System. URL to the master page. |
System. false (default) to apply to currently inheriting subsites only; true to force all subsites to inherit |
System. false (default) to apply to subsites; true to only apply to specified site |
SetMasterPagesByName(Web, String, String)
Can be used to set master page and custom master page in single command
Declaration
public static void SetMasterPagesByName(this Web web, string masterPageName, string customMasterPageName)
Parameters
Web
web
Current web |
System. Name of the master page |
System. Name of the custom master page |
SetMasterPagesByUrl(Web, String, String)
Can be used to set master page and custom master page in single command
Declaration
public static void SetMasterPagesByUrl(this Web web, string masterPageUrl, string customMasterPageUrl)
Parameters
Web
web
Current web |
System. Url of the master page |
System. Url of the custom master page |
SetSiteToInheritPageLayouts(Web)
Can be used to set the site to inherit the default page layout option from parent. Cannot be used for root site of the site collection
Declaration
public static void SetSiteToInheritPageLayouts(this Web web)
Parameters
Web
web
Web to operate against |
SetThemeByUrl(Web, String, String, String, Boolean, Boolean)
Recursively applies the specified palette, font, and background image.
Declaration
public static void SetThemeByUrl(this Web web, string paletteServerRelativeUrl, string fontServerRelativeUrl, string backgroundServerRelativeUrl, bool resetSubsitesToInherit = false, bool updateRootOnly = false)
Parameters
Web
web
Web to apply to |
System. URL of palette file to apply |
System. URL of font file to apply |
System. URL of background image to apply |
System. false (default) to apply to currently inheriting subsites only; true to force all subsites to inherit |
System. false (default) to apply to subsites; true to only apply to specified site |
UploadThemeFile(Web, String, Stream, String)
Uploads the specified file (usually an spcolor or spfont file) to the web site themes gallery (usually only exists in the root web of a site collection).
Declaration
public static File UploadThemeFile(this Web web, string fileName, Stream localStream, string themeFolderVersion = "15")
Parameters
Web
web
Web site to upload to |
System. Name of the file to upload |
Stream
localStream
Stream containing the contents of the file |
System. Leaf folder name to upload to; default is "15" |
Returns
File
The uploaded file, with at least the ServerRelativeUrl property available |
UploadThemeFile(Web, String, String)
Uploads the specified file (usually an spcolor or spfont file) to the web site themes gallery (usually only exists in the root web of a site collection).
Declaration
public static File UploadThemeFile(this Web web, string localFilePath, string themeFolderVersion = "15")
Parameters
Web
web
Web site to upload to |
System. Location of the file to be uploaded |
System. Leaf folder name to upload to; default is "15" |
Returns
File
The uploaded file, with at least the ServerRelativeUrl property available |
UploadThemeFile(Web, String, String, String)
Uploads the specified file (usually an spcolor or spfont file) to the web site themes gallery (usually only exists in the root web of a site collection).
Declaration
public static File UploadThemeFile(this Web web, string fileName, string localFilePath, string themeFolderVersion = "15")
Parameters
Web
web
Web site to upload to |
System. Name of the file to upload |
System. Location of the file to be uploaded |
System. Leaf folder name to upload to; default is "15" |
Returns
File
The uploaded file, with at least the ServerRelativeUrl property available |