【问题标题】:How to search for **not** sharedWithMe with Google Drive API v3?如何使用 Google Drive API v3 搜索 **not** sharedWithMe?
【发布时间】:2016-11-13 19:39:49
【问题描述】:

根据API documentation,您可以像搜索“已删除”一样搜索“sharedWithMe”:

trashed      boolean    =, !=   Whether the file is in the trash or not.
sharedWithMe boolean    =, !=   Files that have been shared with the authorized user.

诸如“trashed”、“notrashed”和“trashed=false”之类的查询都按预期工作。 “sharedWithMe”也有效。

但不起作用的是“not sharedWithMe”或“sharedWithMe=false”。什么是正确的语法或这是一个错误?

示例:q=not+sharedWithMe

错误:

"domain": "global",
"reason": "invalid",
"message": "Invalid Value",
"locationType": "parameter",
"location": "q"

【问题讨论】:

  • 查看same documentation,我注意到“sharedWithMe”字段的“=”和“!=”。所以你的“not sharedWithMe”必须像编程一样使用'!=''。
  • 是的,与已丢弃相同。但是sharedWithMe=false 不起作用。我也试过!sharedWithMe。也没有运气。

标签: google-api google-drive-api


【解决方案1】:

我也认为这个问题是 google drive API 实现中的一个错误。

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

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

【讨论】:

  • 此解决方法可能仍然存在问题,因为结果将包含域中任何人都可见的文件(无 sharedWithMeTime 属性),但也不在“我的云端硬盘”中。
  • 'ownedByMe' 可能是难以捉摸的“not sharedWithMe”的一个体面指标
  • 正如在对类似问题的评论中所写,使用'me' in owners 可能是一个不错的选择,至少对于某些人而言
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-30
  • 1970-01-01
相关资源
最近更新 更多