Search for Google Drive files based on new properties resource

google-drive-api

Solution

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.

Problem

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 ?

Original source