public void ApplyMasterPage(SPWeb currentWeb, string masterPath, string customMasterPath) { SPWeb rootWeb = currentWeb.Site.RootWeb; Uri masterUri = new SPUrl(rootWeb, masterPath).AbsoluteUrl; Uri customUri = new SPUrl(rootWeb, customMasterPath).AbsoluteUrl; UpdateWebMasterPages(currentWeb, masterUri, customUri); }
/// <summary> /// Reverts the master page url of all the web in a site to Seattle. /// </summary> /// <param name="site">The site containing all the web to update.</param> public void RevertToSeattle(SPSite site) { var masterPageFile = this.GetSiteRelativeMasterPageUrl(site, this.seattleMasterPageFileName); var seattleMasterPageUri = new SPUrl(site.RootWeb, masterPageFile.Url).AbsoluteUrl; UpdateMasterPages(site, seattleMasterPageUri, seattleMasterPageUri); }
/// <summary> /// Applies the master page url on all the web of a site. /// </summary> /// <param name="site">The web to update.</param> /// <param name="systemMasterPageFileName">System MasterPage filename</param> /// <param name="publishingMasterPageFileName">Publishing MasterPage filename</param> public void ApplyRootMasterPage(SPSite site, string systemMasterPageFileName, string publishingMasterPageFileName) { Uri systemMasterPageUri = null; Uri publishingMasterPageUri = null; if (!string.IsNullOrEmpty(systemMasterPageFileName)) { systemMasterPageUri = new SPUrl(site.RootWeb, this.GetSiteRelativeMasterPageUrl(site, systemMasterPageFileName).Url).AbsoluteUrl; } if (!string.IsNullOrEmpty(publishingMasterPageFileName)) { publishingMasterPageUri = new SPUrl(site.RootWeb, this.GetSiteRelativeMasterPageUrl(site, publishingMasterPageFileName).Url).AbsoluteUrl; } UpdateMasterPages(site, systemMasterPageUri, publishingMasterPageUri); }
public void RevertToDefaultMasterPage(SPWeb currentWeb, string originalMasterPath) { SPWeb rootWeb = currentWeb.Site.RootWeb; Uri masterUri = new SPUrl(rootWeb, originalMasterPath).AbsoluteUrl; UpdateWebMasterPages(currentWeb, masterUri, masterUri); }