google-api-nodejs-client icon indicating copy to clipboard operation
google-api-nodejs-client copied to clipboard

drive.files.list query on properties not working

Open djholly123 opened this issue 11 years ago • 4 comments

trying to do a search for files with specific custom property which I have successfully set and and can see the properties array if I cheat an get the file directly (knowing its id)

the q below is not working get 400 error "Invalid query"

var args = {
    corpus: "DEFAULT",
    maxResults: 10,
    q:  "properties has { key='ufn' }"
};
drive.files.list(args, function(err, rd){
    if(err){
        return cb(err, null);
    }
    return cb(null, rd);
});

also if I follow the documentation at : https://developers.google.com/drive/web/search-parameters#properties

and try and use a q like: "properties has { key='ufn' and value='8e8aceg2af2ge72e78' and visibility='PRIVATE' }" gives same error.

Is documentation correct because it does not work in web interface either.

any help appreciated

djholly123 avatar May 20 '15 17:05 djholly123

I had the same issuse and solved it. Post it here even after a year, in case anybody need it. You need to specify key and value at the same time , NO VISIBILITY. You can search by appProperties as well.

properties has { key='customKeyA' and value='customKeyAValue2'}

raychenfj avatar Sep 07 '16 08:09 raychenfj

(Marking this as closed due to staleness - @djholly123 feel free to reopen if this is still a problem for you. Thanks!)

ace-n avatar Apr 14 '17 20:04 ace-n

Hi, It's working for me. This gives a result when we give the exact key and value. how to do contains check. Example: A file has properties key is "FileKey" and value is "FileValue" I give the search value like "File". How to get the file

Vigneshwaran22 avatar Aug 13 '19 06:08 Vigneshwaran22

Greetings @Vigneshwaran22! If you're running into trouble, please file a new issue complete with a code sample, the version of the module you're using, and any other details. Thanks!

JustinBeckwith avatar Aug 13 '19 16:08 JustinBeckwith