diff --git a/CHANGELOG.md b/CHANGELOG.md index 616a30e9f..dd0efc1dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,8 +65,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added the ability to `Get-PnPPage` to return all site pages in the site by omitting the `-Identity` parameter [#4805](https://github.com/pnp/powershell/pull/4805) - Added `Copy-PnPPage`, `Move-PnPPage` and `Get-PnPPageCopyProgress` cmdlets to allow for copying and moving site pages between sites [#4806](https://github.com/pnp/powershell/pull/4806) - Added `Get-PnPBrandCenterConfig` to retrieve the configuration of the Brand Center on the tenant [#4830](https://github.com/pnp/powershell/pull/4830) -- Added `Get-PnPBrandCenterFont` to retrieve the available fonts from the various Brand Centers [#4830](https://github.com/pnp/powershell/pull/4830) -- Added `Use-PnPBrandCenterFont` to apply the specified font from the Brand Center to the current site [#4830](https://github.com/pnp/powershell/pull/4830) +- Added `Get-PnPBrandCenterFontPackage` to retrieve the available font packages from the various Brand Centers [#4830](https://github.com/pnp/powershell/pull/4830) +- Added `Use-PnPBrandCenterFontPackage` to apply the specified font package from the Brand Center to the current site [#4830](https://github.com/pnp/powershell/pull/4830) - Added `Add-PnPBrandCenterFont` to upload a font to the tenant Brand Center [#4830](https://github.com/pnp/powershell/pull/4830) ### Changed diff --git a/documentation/Get-PnPBrandCenterFont.md b/documentation/Get-PnPBrandCenterFontPackage.md similarity index 81% rename from documentation/Get-PnPBrandCenterFont.md rename to documentation/Get-PnPBrandCenterFontPackage.md index 594e79039..8d687e30c 100644 --- a/documentation/Get-PnPBrandCenterFont.md +++ b/documentation/Get-PnPBrandCenterFontPackage.md @@ -2,12 +2,12 @@ Module Name: PnP.PowerShell schema: 2.0.0 applicable: SharePoint Online -online version: https://pnp.github.io/powershell/cmdlets/Get-PnPBrandCenterFont.html +online version: https://pnp.github.io/powershell/cmdlets/Get-PnPBrandCenterFontPackage.html external help file: PnP.PowerShell.dll-Help.xml -title: Get-PnPBrandCenterFont +title: Get-PnPBrandCenterFontPackage --- -# Get-PnPBrandCenterFont +# Get-PnPBrandCenterFontPackage ## SYNOPSIS Returns the available fonts configured throught heBrand Center @@ -16,12 +16,12 @@ Returns the available fonts configured throught heBrand Center ### All ```powershell -Get-PnPBrandCenterFont [-Store ] [-Connection ] +Get-PnPBrandCenterFontPackage [-Store ] [-Connection ] ``` ### Single ```powershell -Get-PnPBrandCenterFont -Identity [-Store ] [-Connection ] +Get-PnPBrandCenterFontPackage -Identity [-Store ] [-Connection ] ``` ## DESCRIPTION @@ -31,28 +31,28 @@ Allows retrieval of the available fonts from the various Brand Centers. ### EXAMPLE 1 ```powershell -Get-PnPBrandCenterFont +Get-PnPBrandCenterFontPackage ``` Returns all the available fonts ### EXAMPLE 2 ```powershell -Get-PnPBrandCenterFont -Store Site +Get-PnPBrandCenterFontPackage -Store Site ``` Returns the available fonts from the site collection Brand Center ### EXAMPLE 3 ```powershell -Get-PnPBrandCenterFont -Identity "My awesome font" +Get-PnPBrandCenterFontPackage -Identity "My awesome font" ``` Looks up and returns the font with the name "My awesome font" from any of the Brand Centers ### EXAMPLE 4 ```powershell -Get-PnPBrandCenterFont -Identity "2812cbd8-7176-4e45-8911-6a063f89a1f1" +Get-PnPBrandCenterFontPackage -Identity "2812cbd8-7176-4e45-8911-6a063f89a1f1" ``` Looks up and returns the font with the Identity "2812cbd8-7176-4e45-8911-6a063f89a1f1" from any of the Brand Centers diff --git a/documentation/Use-PnPBrandCenterFont.md b/documentation/Use-PnPBrandCenterFontPackage.md similarity index 84% rename from documentation/Use-PnPBrandCenterFont.md rename to documentation/Use-PnPBrandCenterFontPackage.md index 63d7a08a5..7596d7923 100644 --- a/documentation/Use-PnPBrandCenterFont.md +++ b/documentation/Use-PnPBrandCenterFontPackage.md @@ -2,12 +2,12 @@ Module Name: PnP.PowerShell schema: 2.0.0 applicable: SharePoint Online -online version: https://pnp.github.io/powershell/cmdlets/Use-PnPBrandCenterFont.html +online version: https://pnp.github.io/powershell/cmdlets/Use-PnPBrandCenterFontPackage.html external help file: PnP.PowerShell.dll-Help.xml -title: Use-PnPBrandCenterFont +title: Use-PnPBrandCenterFontPackage --- -# Use-PnPBrandCenterFont +# Use-PnPBrandCenterFontPackage ## SYNOPSIS Applies the specified font from the Brand Center to the current site. @@ -15,7 +15,7 @@ Applies the specified font from the Brand Center to the current site. ## SYNTAX ```powershell -Use-PnPBrandCenterFont -Identity [-Store ] [-Connection ] +Use-PnPBrandCenterFontPackage -Identity [-Store ] [-Connection ] ``` ## DESCRIPTION @@ -25,14 +25,14 @@ Applies the specified font from the Brand Center to the current site. ### EXAMPLE 1 ```powershell -Use-PnPBrandCenterFont -Identity "2812cbd8-7176-4e45-8911-6a063f89a1f1" +Use-PnPBrandCenterFontPackage -Identity "2812cbd8-7176-4e45-8911-6a063f89a1f1" ``` Looks up and applies the font with the identity "2812cbd8-7176-4e45-8911-6a063f89a1f1" from any of the Brand Centers to the current site ### EXAMPLE 2 ```powershell -Use-PnPBrandCenterFont -Identity "My awesome font" -Store Tenant +Use-PnPBrandCenterFontPackage -Identity "My awesome font" -Store Tenant ``` Looks up and applies the font with the title "My awesome font" from the tenant Brand Center diff --git a/src/Commands/Base/Completers/BrandCenterFontCompleter.cs b/src/Commands/Base/Completers/BrandCenterFontPackageCompleter.cs similarity index 78% rename from src/Commands/Base/Completers/BrandCenterFontCompleter.cs rename to src/Commands/Base/Completers/BrandCenterFontPackageCompleter.cs index 4cc33a758..0099c54c7 100644 --- a/src/Commands/Base/Completers/BrandCenterFontCompleter.cs +++ b/src/Commands/Base/Completers/BrandCenterFontPackageCompleter.cs @@ -8,12 +8,12 @@ namespace PnP.PowerShell.Commands.Base.Completers { - public sealed class BrandCenterFontCompleter : PnPArgumentCompleter + public sealed class BrandCenterFontPackageCompleter : PnPArgumentCompleter { protected override IEnumerable GetArguments(string commandName, string parameterName, string wordToComplete, CommandAst commandAst, IDictionary fakeBoundParameters) { ClientContext.Web.EnsureProperty(w => w.Url); - var fonts = BrandCenterUtility.GetFonts(null, ClientContext, ClientContext.Web.Url); + var fonts = BrandCenterUtility.GetFontPackages(null, ClientContext, ClientContext.Web.Url); return fonts.Select(font => new CompletionResult(font.Title)).OrderBy(ct => ct.CompletionText); } } diff --git a/src/Commands/Base/PipeBinds/BrandCenterFontPipeBind.cs b/src/Commands/Base/PipeBinds/BrandCenterFontPipeBind.cs index b02b2afb1..1a0bf09ca 100644 --- a/src/Commands/Base/PipeBinds/BrandCenterFontPipeBind.cs +++ b/src/Commands/Base/PipeBinds/BrandCenterFontPipeBind.cs @@ -54,12 +54,12 @@ public Font GetFont(BasePSCmdlet cmdlet, ClientContext clientContext, string web } else if (_id.HasValue) { - _font = BrandCenterUtility.GetFontById(cmdlet, clientContext, _id.Value, webUrl, store); + _font = BrandCenterUtility.GetFontPackageById(cmdlet, clientContext, _id.Value, webUrl, store); return _font; } else if (!string.IsNullOrEmpty(_title)) { - _font = BrandCenterUtility.GetFontByTitle(cmdlet, clientContext, _title, webUrl, store); + _font = BrandCenterUtility.GetFontPackageByTitle(cmdlet, clientContext, _title, webUrl, store); return _font; } return null; diff --git a/src/Commands/Branding/GetBrandCenterFont.cs b/src/Commands/Branding/GetBrandCenterFontPackage.cs similarity index 80% rename from src/Commands/Branding/GetBrandCenterFont.cs rename to src/Commands/Branding/GetBrandCenterFontPackage.cs index 448c07280..105e22e2e 100644 --- a/src/Commands/Branding/GetBrandCenterFont.cs +++ b/src/Commands/Branding/GetBrandCenterFontPackage.cs @@ -8,16 +8,16 @@ namespace PnP.PowerShell.Commands.Branding { - [Cmdlet(VerbsCommon.Get, "PnPBrandCenterFont", DefaultParameterSetName = ParameterSet_ALL)] + [Cmdlet(VerbsCommon.Get, "PnPBrandCenterFontPackage", DefaultParameterSetName = ParameterSet_ALL)] [OutputType(typeof(Font), ParameterSetName = new[] { ParameterSet_SINGLE })] [OutputType(typeof(IEnumerable), ParameterSetName = new[] { ParameterSet_ALL })] - public class GetBrandCenterFont : PnPWebCmdlet + public class GetBrandCenterFontPackage : PnPWebCmdlet { private const string ParameterSet_SINGLE = "Single"; private const string ParameterSet_ALL = "All"; [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = ParameterSet_SINGLE)] - [ArgumentCompleter(typeof(BrandCenterFontCompleter))] + [ArgumentCompleter(typeof(BrandCenterFontPackageCompleter))] public BrandCenterFontPipeBind Identity { get; set; } [Parameter(Mandatory = false, ParameterSetName = ParameterSet_SINGLE)] @@ -35,7 +35,7 @@ protected override void ExecuteCmdlet() } else { - WriteObject(BrandCenterUtility.GetFonts(this, ClientContext, CurrentWeb.Url, Store), true); + WriteObject(BrandCenterUtility.GetFontPackages(this, ClientContext, CurrentWeb.Url, Store), true); } } } diff --git a/src/Commands/Branding/SetBrandCenterFont.cs b/src/Commands/Branding/SetBrandCenterFont.cs index 140871c30..afb998142 100644 --- a/src/Commands/Branding/SetBrandCenterFont.cs +++ b/src/Commands/Branding/SetBrandCenterFont.cs @@ -12,7 +12,7 @@ namespace PnP.PowerShell.Commands.Files public class SetBrandCenterFont : PnPWebCmdlet { [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)] - [ArgumentCompleter(typeof(BrandCenterFontCompleter))] + [ArgumentCompleter(typeof(BrandCenterFontPackageCompleter))] public BrandCenterFontPipeBind Identity { get; set; } [Parameter(Mandatory = true)] diff --git a/src/Commands/Branding/UseBrandCenterFont.cs b/src/Commands/Branding/UseBrandCenterFontPackage.cs similarity index 82% rename from src/Commands/Branding/UseBrandCenterFont.cs rename to src/Commands/Branding/UseBrandCenterFontPackage.cs index 1c0e639eb..04822da3d 100644 --- a/src/Commands/Branding/UseBrandCenterFont.cs +++ b/src/Commands/Branding/UseBrandCenterFontPackage.cs @@ -8,12 +8,12 @@ namespace PnP.PowerShell.Commands.Branding { - [Cmdlet(VerbsOther.Use, "PnPBrandCenterFont")] + [Cmdlet(VerbsOther.Use, "PnPBrandCenterFontPackage")] [OutputType(typeof(void))] - public class UseBrandCenterFont : PnPWebCmdlet + public class UseBrandCenterFontPackage : PnPWebCmdlet { [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)] - [ArgumentCompleter(typeof(BrandCenterFontCompleter))] + [ArgumentCompleter(typeof(BrandCenterFontPackageCompleter))] public BrandCenterFontPipeBind Identity { get; set; } [Parameter(Mandatory = false)] @@ -31,7 +31,7 @@ protected override void ExecuteCmdlet() LogWarning($"The font with identity {font.Id} titled '{font.Title}' is not valid. Will try to apply it anyway."); } - var url = $"{BrandCenterUtility.GetStoreUrlByStoreType(font.Store, CurrentWeb.Url)}/GetById('{font.Id}')/Apply"; + var url = $"{BrandCenterUtility.GetStoreFontPackageUrlByStoreType(font.Store, CurrentWeb.Url)}/GetById('{font.Id}')/Apply"; LogDebug($"Applying font by making a POST call to {url}"); RestHelper.Post(Connection.HttpClient, url, ClientContext); } diff --git a/src/Commands/Utilities/BrandCenterUtility.cs b/src/Commands/Utilities/BrandCenterUtility.cs index 001baada5..6ea9b85fe 100644 --- a/src/Commands/Utilities/BrandCenterUtility.cs +++ b/src/Commands/Utilities/BrandCenterUtility.cs @@ -15,7 +15,7 @@ namespace PnP.PowerShell.Commands.Utilities internal static class BrandCenterUtility { /// - /// Retrieves a font from the Brand Center based on its name and optionally store type. + /// Retrieves a font package from the Brand Center based on its name and optionally store type. /// /// Cmdlet for which this runs, used for logging /// Title of the font to retrieve @@ -23,16 +23,16 @@ internal static class BrandCenterUtility /// The store to check for the font. When NULL, it will check all stores. /// ClientContext to use to communicate with SharePoint Online /// The font with the provided identity or NULL if no font found with the provided identity - public static Font GetFontByTitle(BasePSCmdlet cmdlet, ClientContext clientContext, string title, string webUrl, Store store = Store.All) + public static Font GetFontPackageByTitle(BasePSCmdlet cmdlet, ClientContext clientContext, string title, string webUrl, Store store = Store.All) { if (store == Store.All) { - return GetFontByTitle(cmdlet, clientContext, title, webUrl, Store.Site) ?? - GetFontByTitle(cmdlet, clientContext, title, webUrl, Store.Tenant) ?? - GetFontByTitle(cmdlet, clientContext, title, webUrl, Store.OutOfBox); + return GetFontPackageByTitle(cmdlet, clientContext, title, webUrl, Store.Site) ?? + GetFontPackageByTitle(cmdlet, clientContext, title, webUrl, Store.Tenant) ?? + GetFontPackageByTitle(cmdlet, clientContext, title, webUrl, Store.OutOfBox); } - var url = $"{GetStoreUrlByStoreType(store, webUrl)}/GetByTitle('{title}')"; + var url = $"{GetStoreFontPackageUrlByStoreType(store, webUrl)}/GetByTitle('{title}')"; cmdlet?.LogDebug($"Making a GET request to {url} to retrieve {store} font with title {title}."); try { @@ -52,7 +52,7 @@ public static Font GetFontByTitle(BasePSCmdlet cmdlet, ClientContext clientConte } /// - /// Retrieves a font from the Brand Center based on its identity and optionally store type. + /// Retrieves a font package from the Brand Center based on its identity and optionally store type. /// /// Cmdlet for which this runs, used for logging /// Id of the font to retrieve @@ -60,16 +60,16 @@ public static Font GetFontByTitle(BasePSCmdlet cmdlet, ClientContext clientConte /// The store to check for the font. When NULL, it will check all stores. /// ClientContext to use to communicate with SharePoint Online /// The font with the provided identity or NULL if no font found with the provided identity - public static Font GetFontById(BasePSCmdlet cmdlet, ClientContext clientContext, Guid identity, string webUrl, Store store = Store.All) + public static Font GetFontPackageById(BasePSCmdlet cmdlet, ClientContext clientContext, Guid identity, string webUrl, Store store = Store.All) { if (store == Store.All) { - return GetFontById(cmdlet, clientContext, identity, webUrl, Store.Site) ?? - GetFontById(cmdlet, clientContext, identity, webUrl, Store.Tenant) ?? - GetFontById(cmdlet, clientContext, identity, webUrl, Store.OutOfBox); + return GetFontPackageById(cmdlet, clientContext, identity, webUrl, Store.Site) ?? + GetFontPackageById(cmdlet, clientContext, identity, webUrl, Store.Tenant) ?? + GetFontPackageById(cmdlet, clientContext, identity, webUrl, Store.OutOfBox); } - var url = $"{GetStoreUrlByStoreType(store, webUrl)}/GetById('{identity}')"; + var url = $"{GetStoreFontPackageUrlByStoreType(store, webUrl)}/GetById('{identity}')"; cmdlet?.LogDebug($"Making a GET request to {url} to retrieve {store} font with identity {identity}."); try { @@ -89,38 +89,38 @@ public static Font GetFontById(BasePSCmdlet cmdlet, ClientContext clientContext, } /// - /// Retrieves fonts from the Brand Center optionally based on the store type. + /// Retrieves font packages from the Brand Center optionally based on the store type. /// /// Cmdlet for which this runs, used for logging /// Url to use to check the site collection Brand Center /// The store to check for the font. When NULL, it will check all stores. /// ClientContext to use to communicate with SharePoint Online /// The available fonts - public static List GetFonts(BasePSCmdlet cmdlet, ClientContext clientContext, string webUrl, Store store = Store.All) + public static List GetFontPackages(BasePSCmdlet cmdlet, ClientContext clientContext, string webUrl, Store store = Store.All) { if (store == Store.All) { var allStoresFonts = new List(); - allStoresFonts.AddRange(GetFonts(cmdlet, clientContext, webUrl, Store.Site)); - allStoresFonts.AddRange(GetFonts(cmdlet, clientContext, webUrl, Store.Tenant)); - allStoresFonts.AddRange(GetFonts(cmdlet, clientContext, webUrl, Store.OutOfBox)); + allStoresFonts.AddRange(GetFontPackages(cmdlet, clientContext, webUrl, Store.Site)); + allStoresFonts.AddRange(GetFontPackages(cmdlet, clientContext, webUrl, Store.Tenant)); + allStoresFonts.AddRange(GetFontPackages(cmdlet, clientContext, webUrl, Store.OutOfBox)); return allStoresFonts; } - var url = GetStoreUrlByStoreType(store, webUrl); + var url = GetStoreFontPackageUrlByStoreType(store, webUrl); cmdlet?.LogDebug($"Making a GET request to {url} to retrieve {store} fonts."); var fonts = RestHelper.Get>(Framework.Http.PnPHttpClient.Instance.GetHttpClient(), url, clientContext); return fonts.Items.ToList(); } /// - /// Returns the URL to the Brand Center based on the store type + /// Returns the font package URL to the Brand Center based on the store type /// /// Brand Center store to connect to /// Base URL to connect to /// /// Thrown if an invalid store type has been provided - public static string GetStoreUrlByStoreType(Store store, string webUrl) + public static string GetStoreFontPackageUrlByStoreType(Store store, string webUrl) { return store switch {