列出在Google Drive API v3和.NET中没有自定义属性的文件夹 [英] List folders which has not a custom property in Google Drive API v3 and .NET

查看:42
本文介绍了列出在Google Drive API v3和.NET中没有自定义属性的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想列出所有没有 imdb 属性键或者其值为null/empty的项目.我尝试过(我正在使用适用于.NET的Google Drive API):

I want to list all those items that has no imdb property key or if its value is null/empty. I tried wtih (I'm using Google Drive API for .NET) :

var request = PrepareListRequest(itemsPerPage, nextPageToken);
request.Q = $"'{id}' in parents and not properties has (imdb) or properties(imdb) is null"; // don't know here.

方法:

private FilesResource.ListRequest PrepareListRequest(int itemsPerPage, string nextPageToken)
{
  var request = dataService.Files.List();
  request.PageSize = itemsPerPage;
  request.SupportsAllDrives = true;
  request.IncludeItemsFromAllDrives = true;

  if (!string.IsNullOrWhiteSpace(nextPageToken))
  {
    request.PageToken = nextPageToken;
  }

  request.Fields = "nextPageToken, files";
  return request;
}

但是我出现了400个错误:

But I got 400 error:

更新1:我也尝试过

  request.Q = $"'{id}' in parents and not properties has {{ key='imdb' }}";

出现相同的错误.

更新2:我尝试过:

 request.Q = $"'{id}' in parents (and properties has {{ key='imdb' and value=null) }} or not properties has {{ key='imdb' and value='' }})";

我想获取属性列表中没有 imdb 的文件/文件夹.

I want to get files/folders which don't have imdb in properties list.

如何实现这一目标?

推荐答案

我想找到解决方案,如果要显示属性中没有 xxx 的项目:

I found solution, if want to display items which don't have xxx in properties:

request.Q = $"'{id}' in parents and (properties has {{ key='xxx' and value='' }} or not properties has {{ key='xxx' and value='' }})";

这篇关于列出在Google Drive API v3和.NET中没有自定义属性的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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