Sid Sid -5 years ago 156
Javascript Question

Prevent email notification while adding a commenter in google appscript?

I am adding commenter using google appscript using

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++) {


Answer Source

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:

     'role': 'reader',
     'type': 'user',
     'value': '',
     'additionalRoles': ['commenter']
     'sendNotificationEmails': 'false'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download