0

I have a google-appmaker project where I add the list of possible viewers down the workflow chain to a file. Once the user attaches a file and starts the workflow, I take the attached file and the viewers down the chain to it so that they can view it.

However when I use it, it also sends another email to the user, and the viewers that the file is shared. Ideally I'd like to add them without triggering the email since there is also another email that goes when the workflow starts. Is there a way to add viewers without notifying them file.addViewers doc.

Thanks

work monitored
  • 431
  • 6
  • 17
  • Seen the duplicate after answering it... how silly ;) However the answer remains useful IMHO because the original answer is a bit old and has a 3 different solution, only one of them being valid (not the accepted one !). – Serge insas Oct 06 '17 at 22:27

1 Answers1

0

This can be done using the advanced Drive API.

Documentation is here

and code goes like this :

function testFileSharing() {
  shareFile("14fQ#################9SW2SIIutz5qk");  
}

function shareFile(ID){
  var permission = Drive.Permissions.insert({value:"test@gmail.com",role:"reader",type:"user"},ID,{sendNotificationEmails:false,emailMessage:"testing for you"});
  Logger.log(JSON.stringify(permission));
}

The advanced Drive API must be enabled in the ressources menu and in the Google API Console. enter image description here

Serge insas
  • 45,904
  • 7
  • 105
  • 131