diff --git a/documentation/Set-PnPList.md b/documentation/Set-PnPList.md index 122d0f24e..1b90af313 100644 --- a/documentation/Set-PnPList.md +++ b/documentation/Set-PnPList.md @@ -23,7 +23,7 @@ Set-PnPList -Identity [-EnableContentTypes ] [-BreakRole [-EnableModeration ] [-DraftVersionVisibility ] [-ReadSecurity ] [-WriteSecurity ] [-NoCrawl] [-ExemptFromBlockDownloadOfNonViewableFiles ] [-DisableGridEditing ] [-DisableCommenting ] [-EnableAutoExpirationVersionTrim ] [-ExpireVersionsAfterDays ] - [-DefaultSensitivityLabelForLibrary ] [-Path ] [-OpenDocumentsMode ] [-Connection ] + [-DefaultSensitivityLabelForLibrary ] [-Path ] [-OpenDocumentsMode ] [-Color ] [-Icon ] [-Connection ] ``` ## DESCRIPTION @@ -108,6 +108,13 @@ Set-PnPList -Identity "Demo List" -DefaultSensitivityLabelForLibrary "Confidenti Sets the default sensitivity label for a document library to Confidential. +### EXAMPLE 12 +```powershell +Set-PnPList -Identity "Demo List" -Color Green -Icon "Plane" +``` + +Changes the icon of the list to a plane, and the background color of the icon to green. + ## PARAMETERS ### -BreakRoleInheritance @@ -586,6 +593,36 @@ Enable modern audience targeting in a SharePoint list. Please make sure the foll Type: Boolean Parameter Sets: (All) +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Icon +The icon of the list. + +```yaml +Type: ListIcon +Parameter Sets: (All) + +Accepted values: Bug, Calendar, Target, Clipboard, Plane, Rocket, ColorPalette, Lightbulb, Cube, Beaker, Robot, PiggyBank, Playlist, Hospital, Bank, MapPin, CoffeCup, ShoppingCart, BirthdayCake +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Color +The background color of the list icon. + +```yaml +Type: ListColor +Parameter Sets: (All) + +Accepted values: DarkRed, Red, Orange, Green, DarkGreen, Teal, Blue, NavyBlue, BluePurple, DarkBlue, Lavender , Pink Required: False Position: Named Default value: None diff --git a/src/Commands/Enums/ListColor.cs b/src/Commands/Enums/ListColor.cs new file mode 100644 index 000000000..c8a6188e1 --- /dev/null +++ b/src/Commands/Enums/ListColor.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PnP.PowerShell.Commands.Enums +{ + public enum ListColor : short + { + DarkRed = 0, + Red = 1, + Orange = 2, + Green = 3, + DarkGreen = 4, + Teal = 5, + Blue = 6, + NavyBlue = 7, + BluePurple = 8, + DarkBlue = 9, + Lavender = 10, + Pink = 11, + } +} diff --git a/src/Commands/Enums/ListIcon.cs b/src/Commands/Enums/ListIcon.cs new file mode 100644 index 000000000..6837e955d --- /dev/null +++ b/src/Commands/Enums/ListIcon.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PnP.PowerShell.Commands.Enums +{ + public enum ListIcon : short + { + Bug = 0, + Calendar = 1, + Target = 2, + Clipboard = 3, + Plane = 4, + Rocket = 5, + ColorPalette = 6, + Lightbulb = 7, + Cube = 8, + Beaker = 9, + Robot = 10, + PiggyBank = 11, + Playlist = 12, + Hospital = 13, + Bank = 14, + MapPin = 15, + CoffeCup = 16, + ShoppingCart = 17, + BirthdayCake = 18 + } +} diff --git a/src/Commands/Lists/SetList.cs b/src/Commands/Lists/SetList.cs index 11f167f20..886c051d6 100644 --- a/src/Commands/Lists/SetList.cs +++ b/src/Commands/Lists/SetList.cs @@ -110,6 +110,12 @@ public class SetList : PnPWebCmdlet [Parameter(Mandatory = false)] public bool EnableModernAudienceTargeting; + [Parameter(Mandatory = false)] + public ListColor Color; + + [Parameter(Mandatory = false)] + public ListIcon Icon; + protected override void ExecuteCmdlet() { var list = Identity.GetList(CurrentWeb); @@ -263,6 +269,18 @@ protected override void ExecuteCmdlet() updateRequired = true; } + + if (ParameterSpecified(nameof(Color))) { + list.Color = ((int)Color).ToString(); + updateRequired = true; + } + + if(ParameterSpecified(nameof(Icon))) + { + list.Icon = ((int)Icon).ToString(); + updateRequired = true; + } + if (updateRequired) { list.Update();