Combining Search clauses in Google Drive Java Client Api

286 views Asked by At

I would like to search for a file with a specific title in a specific folder. As per https://developers.google.com/drive/web/search-parameters I am trying following

List<File> files = new ArrayList<File>();
            Files.List request = service.files().list().set("q", "title=\'" + title+ "\'" + " and parents in [\'" + parentId + "\']");

Request parameter looks like the following

{q=title='Tejal Kamble Resume.pdf' and parents in ['0B0792kZaQwP6flBNdS01LUFidmtuNXIteEVnVDVPRTNDellxVENmWkkyejU3Y29Mc0JuRlE']}

Error Response

{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "location" : "q",
    "locationType" : "parameter",
    "message" : "Invalid query",
    "reason" : "invalid"
  } ],
  "message" : "Invalid query"
}

FYI

Following code is working just fine

Files.List request = service.files().list().set("q", "title=\'" + title+ "\'" );

with following request parameter

{q=title='Tejal Kamble Resume.pdf'}

0

There are 0 answers