为什么Google云端硬盘/文件/列表从一个共享驱动器而不是另一个共享驱动器中查找文件?

时间:2020-04-22 19:09:21

标签: google-api google-drive-api google-apis-explorer

我们正在开发一种工具,该工具可以下载Google云端硬盘中的所有电子表格并将其发送到MySQL。这非常适合“我的云端硬盘”。现在,我们已“升级”到企业版G Suite,并发现了访问共享驱动器时出现的问题。

这是使用服务帐户。列出了一个共享驱动器中的文件,但没有列出另一个共享驱动器中的文件。如果我们指定corporadriveId,则会列出另一个驱动器中的文件。

我已经检查了以下权限:

  • 共享驱动器服务帐户的权限相同
  • 未对中间文件夹或文件设置特殊权限

我正在使用Google Drives API列出这样的文件:

$this->googleClient->setScopes(\Google_Service_Drive::DRIVE_METADATA_READONLY);
$googleService = new \Google_Service_Drive($this->googleClient);
$this->throttleIfNecessary();

// Collect file list
$optParams = [
    //'corpora'=> 'domain',
    'orderBy' => 'modifiedTime',
    'pageSize' => $count, // Google default is 100, maximum is 1000
    'q' => "mimeType = 'application/vnd.google-apps.spreadsheet' and modifiedTime >= '$modifiedTime'",
    #'fields' => 'nextPageToken, files(id,modifiedTime)',
    'fields' => 'files(id,modifiedTime)',
    'supportsAllDrives' => 'true',
    'includeItemsFromAllDrives' => 'true',
    'includeTeamDriveItems' => 'true',
    'supportsTeamDrives' => 'true',
    //'corpora' => 'drive',
    //'driveId' => 'oesntuheunt' // PMT Owners Shared Drive
];
print_r($optParams);
// https://developers.google.com/drive/api/v3/reference/files/list
$results = $googleService->files->listFiles($optParams);
print_r($results);

我将如何更新此信息,以便服务帐户可以访问所有共享驱动器中的所有文件?`

0 个答案:

没有答案