Sastry
Sastry

Reputation: 59

Is there any way to search in the properties of google drive files?

I want to search files like this but I am getting exception.

query = "mimeType ='application/pdf' and properties has { key="+ "'" + agency + "'" +"and value contains"+ "'" + someValue + "'" + " and visibility='PUBLIC'} ";
request = service.files().list().setQ(query);

Do we need to search by exact value?

query = "mimeType ='application/pdf' and properties has { key="+ "'" + agency + "'" +"and value = "+ "'" + someValue + "'" + " and visibility='PUBLIC'} ";
request = service.files().list().setQ(query);

The second one is working, but is there any feature to support wildcard characters?

Upvotes: 2

Views: 1588

Answers (2)

Zig Mandel
Zig Mandel

Reputation: 19835

Yes, its in official docs (thou last year they werent searchable).
https://developers.google.com/drive/web/search-parameters#properties to search by exact value.

Upvotes: 1

MayK
MayK

Reputation: 1329

Yes, for custom properties you have to seach with exact values

properties has { key='additionalID' and value='8e8aceg2af2ge72e78' and visibility='PRIVATE' }

https://developers.google.com/drive/web/search-parameters#properties

Upvotes: 5

Related Questions