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 file = DriveApp.getFileById('1eqaThzYmTbZzP-my file id-rXrBrWDW8DwMNeU'); //get file to be attached
var title = 'Apollo 11 Landing';
var startTime = new Date('January 20, 2016 20:00:00 UTC');
var endTime = new Date('January 20, 2016 21:00:00 UTC');
var options = {description:'Sample description', location: 'The Moon', attachments:file}; //can we add attachments like this?
var event = CalendarApp.getDefaultCalendar().createEvent(title, startTime, endTime, options);
}
Is this possible?
Yes, this is possible. First you must enable the Advanced Calendar Service. Then you can do something like this:
For more options, check out the Events documentation.