admin管理员组文章数量:1296875
I have a PHP app needing to query all subfolders of a target folder, to create galleries fetching the subfolder images.
Until now I used the drive.metadata.readonly scope, but Google is not approving the app, saying it can be done using drive.file scope.
Stating the user already approved the oauth screen and grabbed its token, the folders and files query always gives me an empty array.I tried the Drive picker: it gives me the folder ID. Then I run the query based on that folder ID, but same result.
Where am I doing the mistake? Is it really possible to automatically fetch a folder contents knowing its ID with that scope?
I have a PHP app needing to query all subfolders of a target folder, to create galleries fetching the subfolder images.
Until now I used the drive.metadata.readonly scope, but Google is not approving the app, saying it can be done using drive.file scope.
Stating the user already approved the oauth screen and grabbed its token, the folders and files query always gives me an empty array.I tried the Drive picker: it gives me the folder ID. Then I run the query based on that folder ID, but same result.
Where am I doing the mistake? Is it really possible to automatically fetch a folder contents knowing its ID with that scope?
Share asked Feb 11 at 16:49 a-codera-coder 2992 silver badges14 bronze badges 1- If your application created that folder then you can use drve.file if it was created outside your application then you cant access it with that scope – Linda Lawton - DaImTo Commented Feb 12 at 11:08
1 Answer
Reset to default 0It's possible to get the direct children of the folder with the https://www.googleapis/drive/v3/files
endpoint.
Example:
https://www.googleapis/drive/v3/files?q='folderId' in parents
You wont be able, however, to get the whole tree from this, you would need to query the contents of the subfolders on demand.
Source: https://developers.google/drive/api/guides/search-files
Source: https://developers.google/drive/api/guides/ref-search-terms#file-properties
本文标签: phpAccess Google Drive folder files with drivefile scopeStack Overflow
版权声明:本文标题:php - Access Google Drive folder files with drive.file scope - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741646337a2390205.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论