与corpora = domain一起使用时,Drive v3 API文件方法给出“无效参数”错误

时间:2019-03-20 11:26:35

标签: google-api google-drive-api

我需要通过服务器到服务器应用程序访问TeamDrives中组织的所有文件。所有有权访问文件的用户都将发送电子邮件至username @ organisation-domain。

我创建了一个服务帐户,并与拥有管理员角色和完整权限的当前登录用户(username @ organisation-domain)一起在Google控制台(组织->项目-> IAM管理员-> IAM)中列出了该帐户。访问TeamDrives中的文件。

Google Console

通过该服务帐户,我发出请求“ / drive / v3 / files?corpora = domain” ,该请求返回:

"domain": "global",
"reason": "invalid",
"message": "Invalid Value",
"locationType": "parameter",
"location": "q"

尽管没有“ q”参数。

如果删除“ corpora = domain”部分,则会得到属于该服务帐户的所有文件。

我试图添加任何q参数只是为了尝试,例如“ q =名称+包含+“文本”” 。没有语料库,一切都会好起来的-我得到了经过过滤的文件(当然,属于服务帐户)。如果添加corpora = domain,则会收到有关无效参数的相同错误。

我从其他答案中尝试了corpus = domain,corpora = DOMAIN等,但没有结果。 corpus = domain和corpus = DOMAIN给出相同的错误。 corpora = DOMAIN和corpora = default给出“无效值”错误(无位置)。

无论我尝试什么,我都会不断收到这个奇怪的错误-即使没有q参数,q中的值也是无效的。

我也尝试过

corpora: "teamDrive",
includeTeamDriveItems: true,
supportsTeamDrives: true,
teamDriveId: 'XXX',

该服务帐户(通过电子邮件name@id.iam.gserviceaccount.com)已添加到请求中的TeamDrive ID成员中,但我得到了:

"domain": "global",
"reason": "teamDriveMembershipRequired",
"message": "The attempted action requires Team Drive membership."

任何想法我该怎么做?

0 个答案:

没有答案