在Google Apps脚本中将文件所有权转让给其他用户 [英] Transfer ownership of a file to another user in Google Apps Script

查看:124
本文介绍了在Google Apps脚本中将文件所有权转让给其他用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个包含在Google协作平台页面中的小上传用户界面。它让用户上传文档。由于该脚本已发布,它将在我的帐户下运行,并将上传的文件上传到我的谷歌驱动器。我可以从应用程序脚本中添加将文件作为编辑器上传的人员,但我想要做的是让他们成为文件的所有者。 (从应用程序脚本你可以做一个.getOwner()文件...但不是一个.setOwner().....有谁知道一个解决方法?

I have created a little upload UI which I include in a Google Sites page. It let's a user upload a document. Since the script is published it runs under my account and the uploaded file is uploaded to my google drive. I can from apps script add the person that uploaded the file as an editor, but what I would like to do is make them the owner of a file. (from apps script you can do a .getOwner() on a file... but not a .setOwner() ..... does anyone know a workaround?

感谢,

Daniel

推荐答案

文件在Apps Script中不受支持。 Issue 74 是一项增加此功能的功能请求,如果您对该问题进行了明确表示,您将显示对该功能的支持并收到更新通知。

Unfortunately changing the owner of a file isn't supported in Apps Script. Issue 74 is a feature request to add this ability, and if you star the issue you'll show your support for the feature and get notified of updates.

------ EDITED ------

------EDITED------

现在有一个方便的方法叫做setOwner,可以在这里找到: https://developers.google.com/apps-script/reference/drive/file# setOwner(用户)

Now there is a handy method called setOwner, which can be found here: https://developers.google.com/apps-script/reference/drive/file#setOwner(User)

也可以传递新所有者的电子邮件地址而不是User对象,它在某些情况下更加方便:
https ://developers.google.com/apps-script/reference/drive/file#setOwner(String)

There's also the possibility to pass the new owner's email address instead of the User object, which is even more handy in some cases: https://developers.google.com/apps-script/reference/drive/file#setOwner(String)

这篇关于在Google Apps脚本中将文件所有权转让给其他用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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