尝试更改Google云端硬盘中文件的所有者 [英] Trying to change owner on files in Google Drive

查看:1266
本文介绍了尝试更改Google云端硬盘中文件的所有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试更改我云端硬盘中所有文档的所有权,但我收到以下错误消息:

I'm trying to change ownership of documents in my Drive, but I recieve the following error:


很抱歉,发生服务器错误。请稍等,然后重试。 (第12行,代码文件)

We're sorry, a server error occurred. Please wait a bit and try again. (line 12, file "Code")



function transferFiles() {

var files = DriveApp.getFiles();
while (files.hasNext()) {
  var file = files.next();
var owner = file.getOwner().getEmail();

  if (owner != 'adminuser@domain.co.uk'){
    file.setOwner('adminuser@domain.co.uk');

}
  Logger.log(file);

}
}


推荐答案

你描述了一个报道的问题。参见&明星问题2756 :服务器错误用于非法ACL更改

You've described a reported issue. See & star Issue 2756: Server error for illegal ACL change

摘要:只有文件所有者才能更改所有权。管理员帐户不拥有用户的文件,因此他们在这方面没有特殊权限。

Summary: Only the owner of a file can change ownership. Admin accounts don't own user's files, so they have no special privileges in this respect.

使用Drive API(不是Google Apps脚本)模仿域用户的描述见这个答案,不幸的是没有实现细节。

A possible work-around utilizing the Drive API (not Google Apps Script) to impersonate domain users is described in this answer, unfortunately without implementation details.

这篇关于尝试更改Google云端硬盘中文件的所有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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