-
-
Save lordlycastle/95c36c9f1150b136ed92630b04507cb2 to your computer and use it in GitHub Desktop.
Create a Google Calendar event with an attachment in Apps Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createEventWithAttachment() { | |
var driveFileId = '...'; | |
var file = DriveApp.getFileById(driveFileId); | |
var event = { | |
summary: 'Test Event with Attachments', | |
description: 'Woot!', | |
attachments: [{ | |
fileId: driveFileId, | |
fileUrl: file.getUrl(), | |
mimeType: file.getMimeType(), | |
title: file.getName() | |
}], | |
start: { | |
dateTime: '2016-02-18T17:00:00', | |
timeZone: 'America/New_York' | |
}, | |
end: { | |
dateTime: '2016-02-18T18:00:00', | |
timeZone: 'America/New_York' | |
} | |
}; | |
Calendar.Events.insert(event, 'primary', { | |
supportsAttachments: true | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment