Reputation: 43
Looking for a way to use the Search Files API to get a particular folder given the share URL of the folder.
Using this reference here for the various search term possibilities: https://developers.google.com/drive/api/v3/reference/query-ref
https://developers.google.com/apis-explorer/#search/drive.files.list/
For the 'q' variable, have tried:
1) mimeType='application/vnd.google-apps.folder' and properties has { key='webViewLink' and value='https://drive.google.com/drive/folders/xyz123'}
returns empty list even though the value does exist
2) mimeType='application/vnd.google-apps.folder'and webViewLink='https://drive.google.com/drive/folders/xyz123'
returns 'Invalid Value' for the 'q' parameter
Upvotes: 0
Views: 1197
Reputation: 201428
https://drive.google.com/drive/folders/xyz123
.If my understanding is correct, how about this answer? You can retrieve the folder ID from the URL of https://drive.google.com/drive/folders/xyz123
. In this case, the folder ID is xyz123
.
When you want to retrieve the files in the folder using the folder ID as follows. Please use it as q
.
'### folder ID ###' in parents
When you want to retrieve the folders in the folder using the folder ID as follows. Please use it as q
.
'### folder ID ###' in parents and mimeType='application/vnd.google-apps.folder'
xyz123
. If the folder is nested and you want to retrieve all files with the folder structures, please retrieve recursively it by the script.If this was not the result you want, I apologize.
Upvotes: 1