使用fullText或mimeType查询在Google驱动器v3 api中搜索文件会给出“无效值”消息

时间:2019-03-20 07:39:12

标签: .net google-drive-api full-text-search mime-types

当前,我想使用.net框架中的Google.Apis.Drive.v3包在Google驱动器中搜索文件。但是,当我用(fullText contains 'pdf') or (mimeType = 'application/vnd.google-apps.document')填充Files.List()。Q时,它将引发GoogleApiException:Google.Apis.Requests.RequestError无效值[400]错误[Message [无效值]位置[q-参数]原因[无效]域[全局]]。

代码段为:

var service = new DriveService(new BaseClientService.Initializer() { HttpClientInitializer = credential });
var listRequest = service.Files.List();
listRequest.Q = "(fullText contains 'pdf') or (mimeType = 'application/vnd.google-apps.document')";
var fileList = listRequest.Execute();

我还尝试了here(在右侧的Try this API面板中)的API。

当我用q填充(fullText contains 'pdf') or (mimeType = 'application/vnd.google-apps.document')参数,然后单击Execute按钮时。它给出了相同的错误消息。

但是当我在查询or中将and替换为(fullText contains 'pdf') and (mimeType = 'application/vnd.google-apps.document')并再次单击Execute时,它成功了,没有错误!。

使用fullText运算符将mimeType字段和or字段组合在一起时,似乎会出现此问题。

这真是奇怪的行为。也许是Google API的错误。 Here是github中的一个相关问题。

有人有什么主意吗?

0 个答案:

没有答案