Folders are not shown under root directory when us

2020-04-19 05:30发布

I just wanted to see folders and files under root directory when i set ‘root’ in parents in Q, but I can see only one file titled “Get started” pdf file. (I used C# code)

Where are my folders?

But I can see folders when I search by name (ex. name=’Folder1′) in the code. Also I can see the folder output when I use Api test called “Try this API” which is on API help website (https://developers.google.com/drive/v3/reference/files/list).

So only C# code does not show folders? Can you please tell me why it shows only files, not folders?

FYI: I authenticated using service account and used Google Drive v3 SDK.

2条回答
女痞
2楼-- · 2020-04-19 06:22

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)
查看更多
狗以群分
3楼-- · 2020-04-19 06:24

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.

查看更多
登录 后发表回答