rasf s
rasf s

Reputation: 21

Getting the error message "message" : "Invalid Value" when I use google drive api to search a specific file

I am trying to find children of a folder using java Google Drive API

for (com.google.api.services.drive.model.File file : result.getFiles()) {
     System.out.printf("Found file: %s (%s)\n", file.getName(), file.getId());

     String fileId =file.getId();

     FileList childern =  service.files().list().setQ(" 'fileId' in parents").execute();
     }

here instead of hardcoding the value of file ID I am getting dynamically.

Error msg:
{
  "code" : 404,
  "errors" : [ {
    "domain" : "global",
    "location" : "fileId",
    "locationType" : "parameter",
    "message" : "File not found: .",
    "reason" : "notFound"
  } ],
  "message" : "File not found: ."
}

Upvotes: 1

Views: 849

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116938

"File not found: ."

Means exactly that the file id you are looking for does not exist. My java is not the best but i would suggest trying something like this to be sure its placing the id correctly.

request.setQ(String.format("'fileId' in parents", fileId));

Upvotes: 1

Related Questions