我正在研究一个非常简单的脚本,它将更新文档的查看器。在我的Google Apps网域中,默认的共享权限已更改。我的管理员想要返回并更改所有现有文档的共享设置。在开展我的POC工作时,我遇到了一个错误,并想知道是否应该采用另一种GAS。从Google Drive中的文件中删除默认域查看器
问题是,由于“无效的电子邮件”错误,我无法将域用户作为文档查看器移除。
的消息是:Exception: Invalid email: MyDomain.com
预先感谢您的任何援助。
[我已删除记录和错误从下面的代码捕获。]
function removeDomainUser()
{
DocsList.getAllFiles().forEach(
function (file,i ,array)
{
//--Always pick the Domain Viewer--//
var toRemove = -1;
file.getViewers().forEach(
function(user,i)
{
toRemove = user.getEmail() == "MyDomain.com" ? i : toRemove;
}
);
//--If there is a Domain viewer, remove it--//
toRemove > -1 ? file.removeViewer(file.getViewers()[toRemove]) : '';
}
);
}
谢谢。我将不得不使用API来进行这种复古适配(我希望能够确保自己没有做错什么)。 – fooby 2012-07-31 12:46:38