good day!
I was able to create different calendar events using googlesheets thanks as well to our community. However, I now want to put a hyperlink of that created event in a column next to my calendar details. I've as well read about the same problem here, but can't seem to follow it. I'm pretty confused by what the answer meant as "For given event
object of type CalendarEvent and given calendarId
".
In my code, I though the event
was inviteID = eventCal.getEventById(calendarId).split('@')
while the calendarId
is calendarId = Session.getActiveUser().getEmail()
. However, when I now encode them with base64, the eventID generated doesn't match the generated one in my calendar. I've tried out several iterations but still to no avail.
Please check out my code below (I've only included the lines which I think are relevant for easier reading):
function sendInvites(){
var sheet = SpreadsheetApp.getActiveSheet();
var calendarId = Session.getActiveUser().getEmail();
var eventCal = CalendarApp.getCalendarById(calendarId);
eventCal.createEvent(title, sDateTime, eDateTime, details);
var inviteID = eventCal.getEventById(calendarId).split('@');
var inviteURL = "https://calendar.google.com/calendar/r/eventedit/" + Utilities.base64Encode(inviteID[0]+""+calendarId);
sheet.getRange(startrow + x, 26).setValue('=HYPERLINK("' + inviteURL + '","View")');
}
My suspicion is that I'm not correctly extracting the eventID or calendarId. I hope for your guidance on this.
Thanks!