在谷歌appscript中添加评论者时阻止电子邮件通知? [英] Prevent email notification while adding a commenter in google appscript?

查看:208
本文介绍了在谷歌appscript中添加评论者时阻止电子邮件通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用google appscript使用 addCommenter 函数添加评论者。但它会向用户发送邀请。有什么方法可以禁用此电子邮件通知?

I am adding commenter using google appscript using addCommenter function. But it sends invitation to the user. Is there any way to disable this email notification??

这是我的代码

Here is my code

function shareGroup(usersToShare, sheetId) {
    var newFile =DriveApp.getFileById(sheetId);
    for (var i = 0; i <= usersToShare.length - 1; i++) { 
          newFile.addCommenter(usersToShare[i]);               
    }

}


推荐答案

这是使用默认DriveApp服务不可能的。不过,您可以使用高级云端硬盘服务解决此问题(您应通过选择资源>高级Google服务在脚本编辑器中启用 ...然后在Google Developers Console中启用它。)

This isn't possible using the default DriveApp Service. However, you can use the Advanced Drive Service to workaround around this issue (which you should enable in the Script Editor by selecting Resources > Advanced Google services... and then enabled it in the Google Developers Console.)

使用的代码应该是:

The code used should be:

 Drive.Permissions.insert(
   {
     'role': 'reader',
     'type': 'user',
     'value': 'jane.doe@example.com',
     'additionalRoles': ['commenter']
   },
   'fileId',
   {
     'sendNotificationEmails': 'false'
   });

这篇关于在谷歌appscript中添加评论者时阻止电子邮件通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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