/// <summary> /// Constructor for ProvisioningTemplate class /// </summary> public ProvisioningTemplate() { this.connector = new FileSystemConnector(".", ""); this._localizations = new LocalizationCollection(this); this._siteFields = new FieldCollection(this); this._contentTypes = new ContentTypeCollection(this); this._propertyBags = new PropertyBagEntryCollection(this); this._lists = new ListInstanceCollection(this); this._siteSecurity = new SiteSecurity(); this._siteSecurity.ParentTemplate = this; this._composedLook = new ComposedLook(); this._composedLook.ParentTemplate = this; this._features = new Features(); this._features.ParentTemplate = this; this._customActions = new CustomActions(); this._customActions.ParentTemplate = this; this._files = new FileCollection(this); this._directories = new DirectoryCollection(this); this._providers = new ProviderCollection(this); // Deprecated this._extensibilityHandlers = new ExtensibilityHandlerCollection(this); this._pages = new PageCollection(this); this._termGroups = new TermGroupCollection(this); this._supportedUILanguages = new SupportedUILanguageCollection(this); this._addins = new AddInCollection(this); this._siteWebhooks = new SiteWebhookCollection(this); this._clientSidePages = new ClientSidePageCollection(this); }
protected override void ExecuteCmdlet() { SelectedWeb.ApplyTheme(ColorPaletteUrl, FontSchemeUrl, BackgroundImageUrl, ShareGenerated); ClientContext.ExecuteQueryRetry(); ComposedLook composedLook; // Set the corresponding property bag value which is used by the provisioning engine if (SelectedWeb.PropertyBagContainsKey(PROPBAGKEY)) { composedLook = JsonConvert.DeserializeObject<ComposedLook>(SelectedWeb.GetPropertyBagValueString(PROPBAGKEY, "")); } else { composedLook = new ComposedLook(); composedLook.BackgroundFile = ""; SelectedWeb.EnsureProperty(w => w.AlternateCssUrl); composedLook.ColorFile = ""; SelectedWeb.EnsureProperty(w => w.MasterUrl); composedLook.FontFile = ""; SelectedWeb.EnsureProperty(w => w.SiteLogoUrl); } composedLook.Name = composedLook.Name ?? "Custom by PnP PowerShell"; composedLook.ColorFile = ColorPaletteUrl ?? composedLook.ColorFile; composedLook.FontFile = FontSchemeUrl ?? composedLook.FontFile; composedLook.BackgroundFile = BackgroundImageUrl ?? composedLook.BackgroundFile; var composedLookJson = JsonConvert.SerializeObject(composedLook); SelectedWeb.SetPropertyBagValue(PROPBAGKEY, composedLookJson); }
public bool Validate(ComposedLook source, ComposedLook target) { if (!source.BackgroundFile.Trim().ToLower().Equals(target.BackgroundFile.Trim().ToLower())) { return false; } if (!source.ColorFile.Trim().ToLower().Equals(target.ColorFile.Trim().ToLower())) { return false; } if (!source.FontFile.Trim().ToLower().Equals(target.FontFile.Trim().ToLower())) { return false; } if (!source.Name.Trim().ToLower().Equals(target.Name.Trim().ToLower())) { return false; } if (!source.Version.Equals(target.Version)) { return false; } return true; }
protected override void ExecuteCmdlet() { var serverRelativeUrl = SelectedWeb.EnsureProperty(w => w.ServerRelativeUrl); if (ColorPaletteUrl == null) { ColorPaletteUrl = "/_catalogs/theme/15/palette001.spcolor"; } if (!ColorPaletteUrl.ToLower().StartsWith(serverRelativeUrl.ToLower())) { ColorPaletteUrl = ColorPaletteUrl = UrlUtility.Combine(serverRelativeUrl, "/_catalogs/theme/15/palette001.spcolor"); } SelectedWeb.SetThemeByUrl(ColorPaletteUrl, FontSchemeUrl, BackgroundImageUrl, ResetSubwebsToInherit, UpdateRootWebOnly); ClientContext.ExecuteQueryRetry(); if (!SelectedWeb.IsNoScriptSite()) { ComposedLook composedLook; // Set the corresponding property bag value which is used by the provisioning engine if (SelectedWeb.PropertyBagContainsKey(PROPBAGKEY)) { composedLook = JsonConvert.DeserializeObject<ComposedLook>(SelectedWeb.GetPropertyBagValueString(PROPBAGKEY, "")); } else { composedLook = new ComposedLook(); composedLook.BackgroundFile = ""; SelectedWeb.EnsureProperty(w => w.AlternateCssUrl); composedLook.ColorFile = ""; SelectedWeb.EnsureProperty(w => w.MasterUrl); composedLook.FontFile = ""; SelectedWeb.EnsureProperty(w => w.SiteLogoUrl); } composedLook.Name = composedLook.Name ?? "Custom by PnP PowerShell"; composedLook.ColorFile = ColorPaletteUrl ?? composedLook.ColorFile; composedLook.FontFile = FontSchemeUrl ?? composedLook.FontFile; composedLook.BackgroundFile = BackgroundImageUrl ?? composedLook.BackgroundFile; var composedLookJson = JsonConvert.SerializeObject(composedLook); SelectedWeb.SetPropertyBagValue(PROPBAGKEY, composedLookJson); } }