如何使用Google Drive API v3搜索** not ** sharedWithMe?

rmu*_*ler 5 google-api google-drive-api

根据API文档,您可以使用与“交易”相同的方式在“ sharedWithMe”上进行搜索:

trashed      boolean    =, !=   Whether the file is in the trash or not.
sharedWithMe boolean    =, !=   Files that have been shared with the authorized user.
Run Code Online (Sandbox Code Playgroud)

像“已清除”,“未清除”和“ trashed = false”之类的查询均按预期工作。也可以使用“ sharedWithMe”。

但是什么是行不通的是“ not sharedWithMe”或“ sharedWithMe = false”。正确的语法是什么,或者这是个错误?

示例:q = not + sharedWithMe

错误:

"domain": "global",
"reason": "invalid",
"message": "Invalid Value",
"locationType": "parameter",
"location": "q"
Run Code Online (Sandbox Code Playgroud)

小智 2

我还相信这个问题是 google Drive API 实现中的一个错误。

我正在通过使用从每个列表请求返回的“sharedWithMeTime”属性来解决这个问题(在python中)。在我取回所有项目(是否为sharedWithMe)后,我测试每个项目中是否存在sharedWithMeTime 属性。如果不是,那么该项目必须是“not shareWithMe”,这就是我想用作查询的项目,但收到了 OP 描述的错误。

列表请求中的 python 文档链接如下: https ://developers.google.com/resources/api-libraries/documentation/drive/v3/python/latest/drive_v3.files.html#list

  • 正如在类似问题的评论中所写的那样,在业主中使用“我”可能是一个不错的选择,至少对于某些人来说 (4认同)