【发布时间】:2018-02-22 12:29:15
【问题描述】:
刚开始尝试使用 Google Drive API,我可以在我的云端硬盘中迭代我的文件(经过测试,但不是在当前代码中,我知道这一点),但我也想迭代我的团队云端硬盘文件并打印每个人的名字和身份证。
在下面找到的代码 sn-p,结果为零,因为我有多个团队驱动器,所以我期望一个非零整数值。
public static Drive getDriveService() throws IOException {
Credential credential = authorize();
return new Drive.Builder(
HTTP_TRANSPORT, JSON_FACTORY, credential)
.setApplicationName(APPLICATION_NAME)
.build();
}
public static void main(String[] args) throws IOException {
// Build a new authorized API client service.
Drive service = getDriveService();
Drive.Files.List tmp = service.files().list();
System.out.println(tmp.size());
}
也许值得一提:我使用的是 Google Drive API V3。
【问题讨论】:
标签: java google-drive-api