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

how to create shortcut files? #218

Closed
abubelinha opened this issue Jul 26, 2022 · 1 comment
Closed

how to create shortcut files? #218

abubelinha opened this issue Jul 26, 2022 · 1 comment

Comments

@abubelinha
Copy link

Maybe this is not PyDrive2 specific issue, but I would like to see an example of how to deal with files having mimeType = 'application/vnd.google-apps.shortcut'

I am trying to process (copy) a list of Gdrive files, but one of them is a shortcut to another file.
In Gdrive UI, clicking on a shortcut file opens the target file.
But in PyDrive2, when looking at the shortcut file properties, I don't know where to find the target file id.

I saw in this SO post that there should be a shortcutDetails property in those files:

Those files have an addition field called: 'shortcutDetails'. It's look like this:
'shortcutDetails': {'targetId': SOME_ID, 'targetMimeType': SOME_MIMETYPE}

But I am not finding any of that information in PyDrive2 returned info.
Any hints?

Thanks a lot in advance

PS - I am not needing the following by now, but a related question would be: how to create a shortcut file using PyDrive2?

@abubelinha abubelinha changed the title deal with Google Drive shortcuts - missing info in PyDrive2 ? create shortcut Jul 26, 2022
@abubelinha
Copy link
Author

abubelinha commented Jul 26, 2022

Sorry, the "howto read a shortcut" question above was a duplicated issue of #74 , solved by this example:
https://docs.iterative.ai/PyDrive2/filemanagement/#handling-special-metadata

if f['mimeType']=='application/vnd.google-apps.shortcut':
	f.FetchMetadata(fields='shortcutDetails')
	print("SHORTCUT:\n", f['shortcutDetails'])

So I recycle the issue and change its title to "how to create shortcut files", just in case anybody else is interested.

But probably, that is not a PyDrive2 issue at all (just a general Gdrive API question). So I'll close the issue as well.
For reference, some info here I still didn't try myself using PyDrive2:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant