2016-11-13 87 views
2

按照API documentation你可以以同样的方式为“丢弃”上“sharedWithMe”搜索:如何使用Google Drive API v3搜索** not ** sharedWithMe?

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

查询,如“看不上”,“不丢弃”和“丢弃=假”作为一切工作的预期。另外“sharedWithMe”的作品。

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

实施例:Q =未+ sharedWithMe

错误:

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

渡过了[相同的文档(https://developers.google.com/drive/v3/web/search-parameters),我注意到'sharedWithMe'字段的'=''和'!=''。所以你的“not sharedWithMe”必须像使用编程一样使用'!=''。 – noogui

+1

是的,和垃圾一样。但'sharedWithMe = false'不起作用。我也尝试过'!sharedWithMe'。没有运气。 – rmuller

回答

2

我也相信这个问题是在谷歌驱动API实现中的错误。

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

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

+0

此变通办法可能仍然存在问题,因为结果将包括域中任何人都可以看到的文件(无sharedWithMeTime属性),但也不在“我的云端硬盘”中。 – MitchN

+0

'ownedByMe'也许是一个难以捉摸的“不sharedWithMe”的体面指标, – MitchN