Delete TeamDrive Members

186 views
Skip to first unread message

James SEYMOUR

unread,
Mar 7, 2019, 12:55:57 AM3/7/19
to GAM for G Suite
I am trying to look for a way to delete the members of a TeamDrive. One of our teachers has created a TeamDrive and added a lot of individual students and reached the 500 limit of individuals allowed to be added to a TeamDrive. So now we need to look at an easy way to remove them (and then look at adding groups).

As a test (before converting to run through a CSV file) I have entered this GAM command with the role as reader, member or viewer. The term Viewer is used in Admin Console and the other 2 appear in the info created from GAM, see below.

permissions.50.teamDrivePermissionDetails.0.role reader
permissions.50.teamDrivePermissionDetails.0.teamDrivePermissionType member

Command Run
gam user <user email address> delete permissions teamdriveid <Team Drive ID> <role> 

Output
User: studen...@jis.edu.bn, Delete 1 Drive File/Folder ACL
  Drive File/Folder ID: 0AIMsBtUzR01IUk9PVA, Delete 1 Permission ID
    Drive File/Folder ID: 0AIMsBtUzR01IUk9PVA, Permission ID: viewer, Does not exist

All roles give the same output. Am I missing something or do I need to approach this another way?

Ross Scroggs

unread,
Mar 7, 2019, 11:03:05 AM3/7/19
to google-ap...@googlegroups.com
James,

You delete by permission ID or email address, not role.
With GAMADV-XTD you would do something like this:

gam redirect csv ./TeamDriveMembers.csv print drivefileacls <TeamDriveID> oneitemperrow

Test

gam csv ./TeamDriveMembers.csv matchfield permission.role "(reader)|(member)|(viewer)" gam info drivefileacl ~id  id:~~permission.id~~

Do it

gam csv ./TeamDriveMembers.csv matchfield permission.role "(reader)|(member)|(viewer)" gam delete drivefileacl ~id  id:~~permission.id~~


Ross


--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/c03f1073-6f4e-47c2-9b00-ab59b2525da5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

James SEYMOUR

unread,
Mar 22, 2019, 12:46:38 AM3/22/19
to GAM for G Suite
Thanks Ross.

I subsequently recorded this here, https://sites.google.com/jis.edu.bn/gam-commands/team-drives?authuser=0#h.p_hoIa8kVGrp19, in case this helps anyone else.


On Friday, 8 March 2019 00:03:05 UTC+8, Ross Scroggs wrote:
James,

You delete by permission ID or email address, not role.
With GAMADV-XTD you would do something like this:

gam redirect csv ./TeamDriveMembers.csv print drivefileacls <TeamDriveID> oneitemperrow

Test

gam csv ./TeamDriveMembers.csv matchfield permission.role "(reader)|(member)|(viewer)" gam info drivefileacl ~id  id:~~permission.id~~

Do it

gam csv ./TeamDriveMembers.csv matchfield permission.role "(reader)|(member)|(viewer)" gam delete drivefileacl ~id  id:~~permission.id~~


Ross


On Wed, Mar 6, 2019 at 9:56 PM 'James SEYMOUR' via GAM for G Suite <google-ap...@googlegroups.com> wrote:
I am trying to look for a way to delete the members of a TeamDrive. One of our teachers has created a TeamDrive and added a lot of individual students and reached the 500 limit of individuals allowed to be added to a TeamDrive. So now we need to look at an easy way to remove them (and then look at adding groups).

As a test (before converting to run through a CSV file) I have entered this GAM command with the role as reader, member or viewer. The term Viewer is used in Admin Console and the other 2 appear in the info created from GAM, see below.

permissions.50.teamDrivePermissionDetails.0.role reader
permissions.50.teamDrivePermissionDetails.0.teamDrivePermissionType member

Command Run
gam user <user email address> delete permissions teamdriveid <Team Drive ID> <role> 

Output
User: studen...@jis.edu.bn, Delete 1 Drive File/Folder ACL
  Drive File/Folder ID: 0AIMsBtUzR01IUk9PVA, Delete 1 Permission ID
    Drive File/Folder ID: 0AIMsBtUzR01IUk9PVA, Permission ID: viewer, Does not exist

All roles give the same output. Am I missing something or do I need to approach this another way?

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.


--

Kou Xiong

unread,
Mar 22, 2019, 11:40:29 AM3/22/19
to GAM for G Suite
Thanks James for the site and commands.  I'll be using the same idea to store my commands as well.

Zack McCauley

unread,
Jun 10, 2019, 4:29:39 PM6/10/19
to GAM for G Suite
So tried this today and got some really wierd errors


Ran to remove myself from a teamdrive
$: gam delete drivefileacl 0AFWGyAaQnrycUk9PVA 17232547134505802408
Got this error:

User: zack.mccauley@bsd7.org, Delete 1 Drive File/Folder ACL
 
User: zack.mccauley@bsd7.org, Drive File/Folder ID: 0AFWGyAaQnrycUk9PVA, Permission ID: 08037643876042470314i, Does not exist

I'm not sure where that Permission ID even came from.

The output from trying to figure out the permission ID (which isn't really documented on the wiki (all I keep finding is references to DriveFilePermissionEntity)
gam print drivefileacls 0AFWGyAaQnrycUk9PVA oneitemperrow
Owner,id,permission.deleted,permission.displayName,permission.domain,permission.emailAddress,permission.id,permission.permissionDetails,permission.permissionDetails.0.inherited,permission.permissionDetails.0.permissionType,permission.permissionDetails.0.role,permission.photoLink,permission.role,permission.teamDrivePermissionDetails,permission.teamDrivePermissionDetails.0.inherited,permission.teamDrivePermissionDetails.0.role,permission.teamDrivePermissionDetails.0.teamDrivePermissionType,permission.type
zack
.mccauley@bsd7.org,0AFWGyAaQnrycUk9PVA,False,Zack McCauley,bsd7.org,zack.mccauley@bsd7.org,17232547134505802408,1,False,member,organizer,https://lh6.googleusercontent.com/-FPHhZjnLKnE/AAAAAAAAAAI/AAAAAAAAAYY/O1DqmgJIq10/s64/photo.jpg,organizer,1,False,organizer,member,user

Ross Scroggs

unread,
Jun 10, 2019, 4:52:17 PM6/10/19
to google-ap...@googlegroups.com

Zack,

You want: gam delete drivefileacl 0AFWGyAaQnrycUk9PVA id:17232547134505802408

Ross


--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.

To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

For more options, visit https://groups.google.com/d/optout.


--

Steve - DynTech

unread,
Jun 10, 2019, 5:34:28 PM6/10/19
to GAM for G Suite
Reply all
Reply to author
Forward
0 new messages