Google云端硬盘网络与Google云端硬盘API不匹配 [英] Google drive web doesn't match with Google drive API

查看:115
本文介绍了Google云端硬盘网络与Google云端硬盘API不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已实施Google Drive API工具,并尝试列出Google云端硬盘中保存的所有文件。但我只能看到我使用API​​工具上传的文件。当我使用Google Drive Web上传文件时,我只能在Web界面中看到它,但不能在我的API工具中看到它。我认为使用API​​工具我可以完全访问我的个人Google云端硬盘。为什么我看不到所有文件?



我尝试过:



当我使用Google Drive Web上传文件时,我只能在Web界面中看到它,但不能在我的API工具中看到它。

I have implemented a Google Drive API Tool and i try to list all files which are held in Google Drive. But i only can see the files which i uploaded with my API Tool. When i upload a file with the Google Drive Web then i can see it only in the Web interface, but not in my API Tool. I thought with the API Tool i have full access to my personal Google Drive. Why can't i see all files?

What I have tried:

When i upload a file with the Google Drive Web then i can see it only in the Web interface, but not in my API Tool.

public static Dictionary<string,string> GetFiles(bool gelöschteanzeigen)
        {
            Dictionary<string, string> listdateien = new Dictionary<string, string>();

            string pageToken = null;
            do
            {
                var request = service.Files.List();

                if (gelöschteanzeigen)
                    request.Q = "trashed = true and '" + RootId + "'" + " in parents";
                else
                    request.Q = "trashed = false and '" + RootId + "'" + " in parents";

                request.Spaces = "drive";
               request.Fields = "nextPageToken, files(id, name)";
                request.PageToken = pageToken;
                var result = request.Execute();
                foreach (var file in result.Files)
                {
                    listdateien.Add(file.Id, file.Name);
                }
                pageToken = result.NextPageToken;
            } while (pageToken != null);
            
            
            return listdateien;
        }

推荐答案

我使用Google Drive API做了很多工作,但没有体验过你提到的内容。他们的文件/文件夹系统与大多数人有点不同。检查您是否在正确的文件夹位置。



也许这个文档会有所帮助:搜索文件  | 推动REST API  |  Google Developers [ ^ ]
I have done a lot of work with the Google Drive API and have not experienced what you are mentioning. Their file/folder system works a bit different to most. Check that you are looking in the correct folder location.

Maybe this documentation will help: Search for Files  |  Drive REST API  |  Google Developers[^]


听起来像你正在使用服务帐户身份验证。



请记住服务帐户不是你想到的作为虚拟用户。使用服务帐户上传时,您要上传到服务帐户所拥有的Google云端硬盘帐户。当您运行file.list作为服务帐户时,您将看到上传到服务帐户Google驱动器帐户的文件。



您不会看到文件在您自己的网络版Google云端硬盘中上传到服务帐户google云端硬盘帐户,除非您有服务帐户与您共享文件。



Linda
It sounds to me like you are using service account authentication.

Remember that a service account is not you think of it as a dummy user. When you upload using a service account you are uploading to the google drive account owned by the service account. When you run file.list as the service account you are going to see the files uploaded to the service accounts Google drive account.

You are not going to see the files uploaded to the service accounts google drive account in your own web version of Google drive unless you have the service account share the files with you.

Linda


这篇关于Google云端硬盘网络与Google云端硬盘API不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆