Google Drive API拥有从服务帐户上传的文件的所有权 [英] Google Drive API ownership of files uploaded from service account

查看:107
本文介绍了Google Drive API拥有从服务帐户上传的文件的所有权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用服务帐户从服务器上传文件,并已达到其存储配额限制。所有文件都已添加到由其他用户创建的文件夹下(具有100 Gb存储配额的@ gmail.com帐户),但上传的所有文件都归服务帐户所有。



请注意,我们没有真正的用户,我们只使用Google驱动器进行存储。



目前我们无法使用服务帐户。



是否有办法


  • 转移所有权使用服务帐户拥有的文件到具有100 Gb存储配额的@ gmail.com帐户
  • 使用服务帐户上传文件,但使其由文件所在文件夹的所有者拥有已上传

  • 使用@ gmail.com帐户作为服务帐户



谢谢

解决方案

要传输文件的所有权,您可以依赖Permissions资源中的插入方法。您将需要fileId作为必需参数,并使用以下属性填写请求正文:Role:[owner],Type:[user],以及以下任一ID:[userId in drive]或value:[email从云端硬盘帐户]。
您可以在此链接中找到更多信息: https://开发人员。 google.com/drive/v2/reference/permissions/insert


We are using a service account to upload files from a server and it has reached its storage quota limit. All files had been added under a folder created by another user (a @gmail.com account with 100 Gb storage quota) but all files uploaded are owned by the service account.

Note that we don't have real users, we are only using Google drive for storage purposes.

At the moment we are not able to upload any more files using the service account.

Is there a way to

  • Transfer the ownership of all files owned by the service account to the @gmail.com account with 100 Gb storage quota
  • Upload files using the service account but making them owned by the owner of the folder where the file is being uploaded
  • Use the @gmail.com account as a service account

Thanks

解决方案

To transfer the ownership of the file, you can rely on the "insert" method from the Permissions resource. You will need the fileId as a required parameter, and fill out the request body with the properties for: Role: [owner], Type: [user], and either one of these id:[userId within drive] or value:[email from the Drive account]. You can find more information in this link: https://developers.google.com/drive/v2/reference/permissions/insert

这篇关于Google Drive API拥有从服务帐户上传的文件的所有权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆