Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new FolderColorRgb option to both New-GSDriveFile and Update-GSDriveFile #173

Closed
WJurecki opened this issue Apr 4, 2019 · 3 comments
Assignees

Comments

@WJurecki
Copy link
Contributor

WJurecki commented Apr 4, 2019

Currently unable to set drive folder colors using PSGSuite.

Would like to be able to assign colors to drive folders.

New parameter could be added, such as:

        [parameter(Mandatory = $false)]       
        [ValidateSet('ChocolateIceCream','OldBrickRed','Cardinal','WildStrawberries','MarsOrange','YellowCab','Spearmint','VernFern','Asparagus','SlimeGreen','DesertSand','Macaroni','SeaFoam','Pool','Denim','RainySky','BlueVelvet','PurpleDino','Mouse','MountainGrey','Earthworm','BubbleGum','PurpleRain','ToyEggplant')]
        [string]
        $FolderColorRgb

with a color dictionary of UI allowed colors being defined as:

$ColorDictionary = @{
            ChocolateIceCream    = '#ac725e'
            OldBrickRed          = '#d06b64'
            Cardinal             = '#f83a22'
            WildStrawberries     = '#fa573c'
            MarsOrange           = '#ff7537'
            YellowCab            = '#ffad46'
            Spearmint            = '#42d692'
            VernFern             = '#16a765'
            Asparagus            = '#7bd148'
            SlimeGreen           = '#b3dc6c'
            DesertSand           = '#fbe983'
            Macaroni             = '#fad165'
            SeaFoam              = '#92e1c0'
            Pool                 = '#9fe1e7'
            Denim                = '#9fc6e7'
            RainySky             = '#4986e7'
            BlueVelvet           = '#9a9cff'
            PurpleDino           = '#b99aff'
            Mouse                = '#8f8f8f'
            MountainGrey         = '#cabdbf'
            Earthworm            = '#cca6ac'
            BubbleGum            = '#f691b2'
            PurpleRain           = '#cd74e6'
            ToyEggplant          = '#a47ae2'
        };

filling the body of the API call with

            if ($FolderColorRgb) {
                $body.FolderColorRgb = $ColorDictionary[$FolderColorRgb];
            } 

I believe this will work for Drive folders. I'm not sure if this will cause any issues if attempted on a non-folder file or Team Drive file.

This should allow automation of the UI feature to change a folder's color as seen here:

image

@scrthq scrthq self-assigned this Apr 4, 2019
@scrthq
Copy link
Member

scrthq commented Apr 4, 2019

Hey @WJurecki - Great suggestion! I'm on it ASAP, although PR's always welcome =]

@scrthq
Copy link
Member

scrthq commented Apr 5, 2019

Should be getting this sorted by tonight!

@scrthq scrthq mentioned this issue Apr 7, 2019
scrthq added a commit that referenced this issue Apr 7, 2019
## 2.26.1

* [Issue #172](#172)
  * Fixed: `New-GoogleService` now using `New-Object` to prevent `[Google.Apis.Util.Store.FileDataStore]::new()` constructor issues in PowerShell 4.
* [Issue #173](#173)
  * Added: `FolderColorRgb` parameter to `New-GSDriveFile` and `Update-GSDriveFile` to enable setting the color of a folder in Drive - _Thanks, [@WJurecki](https://github.com/WJurecki)!_
* [PR #174](#174) - _Thanks, [@WJurecki](https://github.com/WJurecki)!_
  * Fixed: `Get-GSDriveFileList` filter concatenation so it joins multiple filters with ` and ` instead of just a space ` `.
@scrthq
Copy link
Member

scrthq commented Apr 7, 2019

available now in v2.26.1!

@scrthq scrthq closed this as completed Apr 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants