Folders are not shown under root directory when use 'root' in parents when using Google Drive api files list

别来无恙 提交于 2019-12-02 05:33:15

If the only file you are seeing is “Get started” pdf file that is a sure sign that you are using a service account for authentication.

Service accounts are not you. Think of it as a dummy user it has its own google drive account which by default has no files.

Options:

  1. Upload files to the service account using the files.create method
  2. Share a folder on your personal google drive account with the service account. You do this by taking the service account email address and sharing a folder with it. Note: to my knowledge you cant share your personal root folder with anyone.

Tip: If you are allowing the service account to upload files to your personal google drive account remember to have it grant your personal user permissions to access the files using permissions.create method or you are going to have files on your drive account that you dont have permissions to access.

I don't know whether this question is answered or not, so I am replying. I was facing the issue when I was using name='root'. It was returning me the list of files and folders but some were missing.

I found somewhere and modified the 'Q' string with the following and it is now showing me the right information.

('root' in parents)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!