taers232c / GAMADV-XTD3

Command line tool to manage Google Workspace
687 stars 86 forks source link

`info drivefile <DriveFileEntity> fields name` doesn't show name with shared drives #406

Closed pjxm closed 3 months ago

pjxm commented 3 months ago

Using GAMADV-XTD3 6.72.07.

When using info drivefile on a shared drive id, the name value returned is inconsistent if I specify fields. For example if I run gam user <my_username> info drivefile <shareddriveid> I get the standard output as follows (trimmed for clarity):

User: my_username@domain.co.uk, Show Info 1 Drive File/Folder
  Drive Folder: PJM Shared Drive (<shareddriveid>)
(clipped)
    name: PJM Shared Drive
...

Whereas if I try and limit the command to just return name (or any combination of fields including name) then the name returned is always "Drive":

$ gam user <my_username> info drivefile <shareddriveid> fields name
User: my_username@domain.co.uk, Show Info 1 Drive File/Folder
  Drive Folder: Drive (<shareddriveid>)
    name: Drive

This only happens with shared drives themselves, any files in user drives are fine, and any sub-items within the shared drive are fine.

taers232c commented 3 months ago

According to the Drive File API files.get call, every Shared Drive is named 'Drive'. If you want the name that the user sees, you have to call drives.get with the driveId returned from files.get.

gam user info drivefile fields name,driveid

If you know you're looking at a Shared Drive, this will also work.

gam user info shareddrive fields name

Ross

Ross Scroggs @.***

On Apr 4, 2024, at 5:00 AM, pjxm @.***> wrote:

Using GAMADV-XTD3 6.72.07.

When using info drivefile on a shared drive id, the name value returned is inconsistent if I specify fields. For example if I run gam user info drivefile I get the standard output as follows (trimmed for clarity):

User: @.***, Show Info 1 Drive File/Folder Drive Folder: PJM Shared Drive () (clipped) name: PJM Shared Drive ... Whereas if I try and limit the command to just return name (or any combination of fields including name) then the name returned is always "Drive":

$ gam user info drivefile fields name User: @.***, Show Info 1 Drive File/Folder Drive Folder: Drive () name: Drive This only happens with shared drives themselves, any files in user drives are fine, and any sub-items within the shared drive are fine.

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/406, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYLZDXEXUZMKLU5HDLE3Y3U6FTAVCNFSM6AAAAABFXD6R42VHI2DSMVQWIX3LMV43ASLTON2WKOZSGIZDKMRZG42DGMI. You are receiving this because you are subscribed to this thread.

pjxm commented 3 months ago

Aha, thanks Ross, guess I didn't try enough of the different fields.

I was looking for a single command to retrieve just the name of any drive ID, regardless of if it's a shared drive or a file, with as little extra info as possible, but adding the id doesn't hurt much.

Thanks, Patrick