I couldn\'t find a way to add an attachment to my calendar event. I hope there should be a simple way like below snippet,
function createNewEvent()
{
var fi
Yes, this is possible. First you must enable the Advanced Calendar Service. Then you can do something like this:
function createNewEvent() {
var calendarId = ''; //Calendar Id String
var fileId = ''; // File Id String
var start = new Date('January 20, 2016 20:00:00 UTC');
var end = new Date('January 20, 2016 21:00:00 UTC');
var eventObj = {
summary: 'Apollo 11 Landing',
location: 'The Moon',
description: 'Sample description',
start: {dateTime: start.toISOString()},
end: {dateTime: end.toISOString()},
attachments: [{
'fileUrl': 'https://drive.google.com/open?id=' + fileId,
'title': 'Moon Docs'
}]
};
var resp = Calendar.Events.insert(eventObj, calendarId, {'supportsAttachments': true});
Logger.log(resp); // Check out the response in the logs!
}
For more options, check out the Events documentation.