下面是我用来查找包含志愿者的文件列表的代码。
private static List<File> retrieveAllFiles(Drive service) throws IOException {
List<File> result = new ArrayList<File>();
Files.List request = service.files().list().setQ("Volunteers");
System.out.println("Request size:" + request.size());
do {
try {
FileList files = request.execute();
System.out.println("Request files size:" + files.size());
result.addAll(files.getItems());
request.setPageToken(files.getNextPageToken());
} catch (IOException e) {
System.out.println("An error occurred: " + e);
request.setPageToken(null);
}
} while (request.getPageToken() != null &&
request.getPageToken().length() > 0);
return result;
}
执行时它返回
[s~sakshumweb-hrd/3.368839385999923807].<stdout>: An error occurred: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 OK
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"location" : "q",
"locationType" : "parameter",
"message" : "Invalid Value",
"reason" : "invalid"
} ],
"message" : "Invalid Value"
}
它有什么问题。