SCRT-HQ / PSGSuite

Powershell module for Google / G Suite API calls wrapped in handy functions. Authentication is established using a service account via P12 key to negate the consent popup and allow for greater handsoff automation capabilities
https://psgsuite.io/
Apache License 2.0
235 stars 67 forks source link

Add-GSTeamDriveMember #207

Closed n-searle closed 5 years ago

n-searle commented 5 years ago

Hi Nate,

Is there already a way to add users as members to a team drive and set their permissions?

I have tried: Update-GSTeamDrive -TeamDriveId 0AMJaWArZXy3jUk9PVA -User my-test-user -CanComment

but get: Update-GSTeamDrive : Exception calling "Execute" with "0" argument(s): "Google.Apis.Requests.RequestError The operation was successful, but there was an error preparing the response. [500] Errors [ Message[The operation was successful, but there was an error preparing the response.] Location[ - ] Reason[responsePreparationFailure] Domain[global] ] " At line:1 char:1

Cheers, Neil

n-searle commented 5 years ago

As an additional I would like to be able to add users and groups as members to team drives.

scrthq commented 5 years ago

hey @n-searle - Totally doable! You can see a sample below, but the command you're looking for is Add-GSDrivePermission 😃 There's a Type parameter on that where you specify if the permission is for a User, a Group, the Domain, or Anyone:

Add-GSDrivePermission -User $OwnerOfDriveFile -FileId $TeamDriveId -Role Commenter -Type User -EmailAddress my-test-user@domain.com
n-searle commented 5 years ago

Awesome, will give it a shot cheers.

scrthq commented 5 years ago

Cool! Let me know if you run into any issues, otherwise close this out if you're comfortable!