The idea is to add some options to set the color of a folder in SharePoint.

Commands to update
Options to add
| Option |
Description |
--color [color] |
Visual color of the folder. Valid values are a color name or a number. Check remarks for more info. |
Remarks:
When you specify a value for color, consider the following:
| Color |
Number value |
String value |
| Yellow |
0 |
yellow |
| Dark red |
1 |
darkRed |
| Dark orange |
2 |
darkOrange |
| Dark green |
3 |
darkGreen |
| Dark teal |
4 |
darkTeal |
| Dark blue |
5 |
darkBlue |
| Dark purple |
6 |
darkPurple |
| Dark pink |
7 |
darkPink |
| Grey |
8 |
darkGrey |
| Light red |
9 |
lightRed |
| Light orange |
10 |
lightOrange |
| Light green |
11 |
lightGreen |
| Light teal |
12 |
lightTeal |
| Light blue |
13 |
lightBlue |
| Light purple |
14 |
lightPurple |
| Light pink |
15 |
lightPink |
Examples
Create a folder with a dark blue look
m365 spo folder add --webUrl https://contoso.sharepoint.com --parentFolder '/ProjectFiles' --name 'Project-x' --color 5
Create a folder with a light teal look
m365 spo folder add --webUrl https://contoso.sharepoint.com --url '/ProjectFiles/Project-x' --color lightTeal
Technical approach
Let's change the current API since it doesn't allow us to stamp the color of a folder. Changing to the API below doesn't change the output generated, so it's not a breaking change.
Setting the folder color is easy, you just have to set the ColorHex field to a number between 0-15.
POST https://tenant.sharepoint.com/sites/MySite/_api/foldercoloring/createfolder(DecodedUrl='/sites/MySite/Projects/Project-x', overwrite=false)
{
"coloringInformation": {
"ColorHex": "3"
}
}
Notice that this API only works when a color is specified. We could either stick with the old API when no color is specified, or we can just pass 0 with the new API to stamp the folder color "yellow".
The idea is to add some options to set the color of a folder in SharePoint.
Commands to update
spo folder addOptions to add
--color [color]Remarks:
When you specify a value for
color, consider the following:0yellow1darkRed2darkOrange3darkGreen4darkTeal5darkBlue6darkPurple7darkPink8darkGrey9lightRed10lightOrange11lightGreen12lightTeal13lightBlue14lightPurple15lightPinkExamples
Create a folder with a dark blue look
Create a folder with a light teal look
m365 spo folder add --webUrl https://contoso.sharepoint.com --url '/ProjectFiles/Project-x' --color lightTealTechnical approach
Let's change the current API since it doesn't allow us to stamp the color of a folder. Changing to the API below doesn't change the output generated, so it's not a breaking change.
Setting the folder color is easy, you just have to set the
ColorHexfield to a number between 0-15.Notice that this API only works when a color is specified. We could either stick with the old API when no color is specified, or we can just pass
0with the new API to stamp the folder color "yellow".