Col*_*hie 10 google-api-python-client
作为谷歌驱动程序用户(使用我的Gmail帐户),我想将我上传的文件的所有权转让给其他用户(使用他们的Gmail帐户).
我发现了这个方便的工具:https://github.com/davidstrauss/google-drive-recursive-ownership,它会调用此方法:
service.permissions().update(fileId=drive_item['id'],
permissionId=permission_id, body=permission, transferOwnership=True).execute()
Run Code Online (Sandbox Code Playgroud)
我已验证fileId是否正确,permission_id是否正确,以及作为正文传入的权限对象.
代码似乎很好,它对谷歌驱动器"本机"文件(如谷歌文档和电子表格)运行良好.
但是当针对上传的PDF运行时,会发生以下错误:
<HttpError 403 when requesting https://www.googleapis.com/drive/v2/files/0Bxz4bvKt4QekTWlUUHg0XzUydTa/permissions/18055737357773114524
?transferOwnership=true&alt=json returned "Insufficient permissions for this file">
Run Code Online (Sandbox Code Playgroud)
为什么改变"原生"谷歌云端硬盘文件的所有权任何想法,使用"更新"的方法,但改变上传文件的所有权(如PDF和docx文件)时不正常工作?
更改Google云端硬盘中非Google文档的所有权只能通过Google Apps帐户进行,而不是使用常规Google帐户.
因此,为了使您的脚本能够正常运行,您需要使用Google Apps帐户进行身份验证,或者下面有一些混乱的解决方法;
https://productforums.google.com/forum/#!topic/drive/Hz1uUukwKmk https://productforums.google.com/forum/#!topic/drive/VPhNE_HkGLs
| 归档时间: |
|
| 查看次数: |
1058 次 |
| 最近记录: |