问题
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.
And the method:
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;
}
But I got 400 error:
Update 1: I tried also
request.Q = $"'{id}' in parents and not properties has {{ key='imdb' }}";
Got same error.
Update 2: I tried:
request.Q = $"'{id}' in parents (and properties has {{ key='imdb' and value=null) }} or not properties has {{ key='imdb' and value='' }})";
I want to get files/folders which don't have imdb
in properties list.
How to achieve this ?
回答1:
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='' }})";
来源:https://stackoverflow.com/questions/63559883/list-folders-which-has-not-a-custom-property-in-google-drive-api-v3-and-net