Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search for Google Drive files based on new properties resource

Google just introduced a new feature in Google Drive SDK which is the ability to set properties to files, as key/value pairs. According to the blog post on Google Developers blog we can use these properties as searchable fields. However I cannot see in the documentation how to search for files using these properties.

For example: retrieve all files where property A has the value X.

I know the feature is brand new but I could really make use of this in my current project. Have I missed anything ?

like image 732
brian Avatar asked Apr 05 '13 05:04

brian


1 Answers

Well I find, its possible to search on drive based on properties param.

Check doc. https://developers.google.com/drive/web/search-parameters

Code Snippet :

resp = newDriveService.files().list(q="properties has { key='customKeyA' and value='customKeyAValue2' and visibility='PUBLIC' }").execute()

Note : you have to specify all 3 params viz. key, value and visibility while searching. If you don't use it will throw Invalid Params exception.

like image 182
Kartik Domadiya Avatar answered Sep 26 '22 19:09

Kartik Domadiya