dongyue5686 2019-02-19 20:20
浏览 34

Team Drive列出所有文件夹,包括儿童

I can get access to the upper level (root level) folders for my TeamDrive, but have bee unsuccessful find out how to get all the sub-folders (the children). What I'd like to perform is getting all children with one call...

I've seen the teamdrive REST API here https://developers.google.com/drive/api/v3/reference/teamdrives/list but this only retrieves the root level.

I can retrieve the next level down by taking the $folderId (this is the folder ID that we're trying to get the children for) and performing 2 calls to retrieve the next level

        $optParams = array(
            'supportsTeamDrives' => true,
        );
        $results = $service->files->get($folderId, $optParams);
        $teamDriveId = $results["teamDriveId"];

then using the resulting $teamDriveId and calling a files->listFiles

        $optParams = array(
        'q'                     => "'{$folderId}' in parents and trashed = false and mimeType = 'application/vnd.google-apps.folder'",
        'pageSize'              => $pageSize,
        'corpora'               => 'teamDrive',
        'includeTeamDriveItems' => true,
        'supportsTeamDrives'    => true,
        'teamDriveId'           => $teamDriveId,    // this must be the parent Id
        'orderBy'               => 'name',
        'pageToken'             => $nextPageToken,
    );

    $results = $service->files->listFiles($optParams);
    $nextPageToken = !isset($results["nextPageToken"]) ? "" : $results["nextPageToken"];

This will be slow as the folders can expand for sometime... Does anyone know how to get the FULL folder & all the children structure for my Team Drives? Does anyone know if this is even allowed? I've tried a lot of different options in my PHP code and the various REST API function test areas.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗
    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法