【问题标题】:Iterate over Team Drive files Google Drive API JAVA迭代团队云端硬盘文件 Google Drive API JAVA
【发布时间】: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


    【解决方案1】:

    当使用 Files.list 意图包含 teamDrive 时,您需要将某些参数设置为 true,例如 includeTeamDriveItems 或语料库。您可以在参考链接中阅读该链接,其中包含用于测试目的的试用版。

    你也可以试试Teamdrives.list

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-20
      • 1970-01-01
      • 2017-09-21
      相关资源
      最近更新 更多