Enable Drive API
In Script Editor go to Resources > Advanced Google services ... > scroll down and turn on Drive API > click OK.
The Code
First we create an array of objects that defines 3 items: value, type and role. These details will form the 'permissions resource':
var resource = {Next we create our 'optional arguments' where we can disable the sending of the email:
// enter email address here
value: 'user@example.com',
// choose from "user" or "group" if using a Google Group
type: 'user',
// choose from: "owner", "writer" or "reader"
role: 'writer'
};
var optionalArgs = {Finally we can put this all together with the addition of our File ID to run the command:
sendNotificationEmails: false
};
Drive.Permissions.insert(resource, 'FILE ID HERE', optionalArgs);Drive API - share a file without email notification
No comments:
Post a Comment