我刚开始使用 google drive API for java,我正在使用与网站上描述的相同代码从 google drive 检索文件列表,但该方法execute
不存在:(我该怎么办?
private static List<File> retrieveAllFiles(Drive service) throws IOException {
List<File> result = new ArrayList<File>();
Files.List request = service.files().list();
do {
try {
FileList files = request.execute(); //The method execute() is undefined for the type Drive.Files.List
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;
}