Syntax for 'gam <user> transfer drive select'

170 views
Skip to first unread message

Aston Wooller

unread,
Nov 13, 2018, 4:44:39 AM11/13/18
to GAM for G Suite
Hey everyone

I'm trying to get my head around recursively transferring ownership of files and subfolders within a folder from one user to another. I want it to work like the native transferral of ownership G Suite supports, but only for a specific folder and its children and not for the rest of the Drive.

It looks like gam <UserTypeEntity> transfer drive in GAMADV-X is the ticket, given that it says I can select a folder using select, or so documentation leads me to believe.

Syntax in GamCommands.txt are:
gam <UserTypeEntity> transfer drive <UserItem> [select <DriveFileEntity>]
        [(targetfolderid <DriveFolderID>)|(targetfoldername <DriveFolderName>)] [targetuserfoldername <DriveFolderName>] [targetuserorphansfoldername <DriveFolderName>]
        [keepuser | (retainrole reader|commenter|writer|editor|none)] [noretentionmessages]
        [nonowner_retainrole reader|commenter|writer|editor|current|none] [nonowner_targetrole reader|commenter|writer|editor|current|none|source]
        (orderby <DriveFileOrderByFieldName> [ascending|descending])*
        [preview] [todrive <ToDriveAttribute>*]


So with this in mind, my test was as follows:
gam user test.a...@example.com transfer drive select 1hDnQ1gGLuXWK2uo1C_WKpg_XLQXDH9vd destinati...@example.com retainrole writer nonowner_targetrole source

The response I get is:
ERROR: 1hDnQ1gGLuXWK2uo1C_WKpg_XLQXDH9vd is not a valid argument for "gam <users> transfer drive"

Then I thought perhaps <UserItem> would need to be entered as an email address of whose ownership I'm trying to change, in addition to the folder, so I tried 
gam user test.a...@example.com transfer drive test.a...@example.com select 1hDnQ1gGLuXWK2uo1C_WKpg_XLQXDH9vd destinati...@example.com retainrole writer nonowner_targetrole source

And the response was:
ERROR: select is not a valid argument for "gam <users> transfer drive"

Is there something I'm missing here? I hope it's something simple.

Am I better off outputting owned files into a csv as mentioned here and then figuring out changing each file's ownership individually?

Thanks
Aston

The information contained in this e-mail message and any accompanying files is or may be confidential. If you are not the intended recipient, any use, dissemination, reliance, forwarding, printing or copying of this e-mail or any attached files is unauthorised. This e-mail is subject to copyright. No part of it should be reproduced, adapted or communicated without the written consent of the copyright owner. If you have received this e-mail in error please advise the sender immediately by return e-mail or telephone and delete all copies. Fairfax Media Group does not guarantee the accuracy or completeness of any information contained in this e-mail or attached files. Internet communications are not secure, therefore Fairfax Media Group does not accept legal responsibility for the contents of this message or attached files.

Ross Scroggs

unread,
Nov 13, 2018, 8:33:57 AM11/13/18
to google-ap...@googlegroups.com
Aston,

<UserItem>, a required argument, must come before all optional arguments.

gam <UserTypeEntity> transfer drive <UserItem> [select <DriveFileEntity>] ...

So you want:
gam user test.a...@example.com transfer drive destinati...@example.com select 1hDnQ1gGLuXWK2uo1C_WKpg_XLQXDH9vd retainrole writer nonowner_targetrole source

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/bcd1ba19-ea95-48be-b4b6-453aff57eb05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aston Wooller

unread,
Nov 13, 2018, 3:15:27 PM11/13/18
to GAM for G Suite
Thanks so much for the reply, Ross. 

I had tried it in that order before with the same error.

Turns out the issue was in running the command from Powershell. Running GAM from the command prompt rather than Powershell made the command work. I'm not sure why it would do this. I notice since updating Windows 10 to 1709 and above Powershell's output is encoded with a Bit Order Mark which ruins all CSVs it generates, but wouldn't have thought that that would affect commands like this.

In any case, thank you for the clarification.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

Aston Wooller

unread,
Nov 13, 2018, 9:52:00 PM11/13/18
to GAM for G Suite
To close this one out for anyone who is searching to do the same as I was/am. Ross is right, the correct command is:
gam user <source email> transfer drive <destination email> select <folder id> retainrole writer nonowner_targetrole source
If you have multiple installations of GAM (such as GAMADV-X as well as the standard GAM) and you're running it through Powershell you'll need to enter .\gam when invoking the app. Even though I was within the folder of GAMADV-X, the gam command was running the standard version from another folder where "select" isn't an option.

In conclusion, Ross is a saint.
Reply all
Reply to author
Forward
0 new messages