Google Drive API v3(不包括Google照片) [英] Google Drive API v3 excluding google photos

查看:68
本文介绍了Google Drive API v3(不包括Google照片)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何,是否可以在下面的通话中隐藏"Google相册"文件夹及其子元素(文件夹和文件)?

Is there anyway to hide the Google Photos folder and his child elements (folder and files) from the below call?

FilesResource.ListRequest listRequest = googleDriveClient.Files.List();
listRequest.IncludeTeamDriveItems = true;
listRequest.SupportsTeamDrives = true;
listRequest.PageSize = 1000;
listRequest.Fields = "nextPageToken,files(id,mimeType,modifiedTime,trashed,kind,name,size,md5Checksum,parents)";
result = listRequest.Execute();

谢谢

推荐答案

对于Google相册文件夹中的文件,space同时具有驱动器"和照片".因此,即使将drive用作spaces的查询参数,也会检索这些文件.

In the case of files in the folder of Google Photos, space has both "drive" and "photo". So even if drive is used to the query parameter of spaces, those files are retrieved.

尽管我认为要使用drive.files.list的Q,但不能使用parents != '### folder ID of Google Photos ###'直接排除Google相册的文件夹.

Although I thought to use Q of drive.files.list, the folder of Google Photos cannot be directly excluded using parents != '### folder ID of Google Photos ###'.

我认为这种情况可能是一个错误,或者可能尚未实现排除Google相册的功能.因此,作为当前解决方案,如何排除Google相册下的文件夹?流程如下.

I think that this situation might be a bug or the function for excluding Google Photos might be not implemented yet. So as a workaround at the current stage, how about excluding the folders under Google Photos? The flow is as follows.

  1. 检索Google相册文件夹下的文件夹ID.
    • "Google相册"下有每个文件夹的名称.
    • 文件夹ID为https://drive.google.com/drive/folders/##########.
  1. Retrieve folder IDs under the folder of Google Photos.
    • There are the folders with the name of each year under the Google Photos.
    • The folder ID is ##### of https://drive.google.com/drive/folders/#####.
  • listRequest.Q = "parents!='### folder ID1 ###' and parents!='### folder ID2 ###' and parents!='### folder ID3 ###' and ,,, and trashed=false"
  • trashed=false表示未检索垃圾箱中的文件.
  • 由于GET方法,端点的长度受到限制.我希望可以在端点长度超出限制之前发布官方方法.
  • listRequest.Q = "parents!='### folder ID1 ###' and parents!='### folder ID2 ###' and parents!='### folder ID3 ###' and ,,, and trashed=false"
  • trashed=false means that the files in trash box are not retrieved.
  • There is the limitation for the length of endpoint because of GET method. I would like to expect that the official method is published before the length of endpoint is over the limitation.

注意:

  • 在这种解决方法中,由于文件夹不包括在"Google Photos"文件夹下,因此仅检索"Google Photos"文件夹.但是未检索到"Google照片"下的文件夹.
    • drive.files.list
    • Search for Files

    如果这对您的情况没有帮助,对不起.

    If this was not useful for your situation, I'm sorry.

    这篇关于Google Drive API v3(不包括Google照片)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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