Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get link (url) to an calendar event in google apps script

I have a Calendar Event in Google Apps Script and I want to allow the user to open it by clicking an Anchor. I think I can the URL has to look like this: http://www.google.com/calendar/event?eid=SOMEID&ctz=Etc/GMT . However I can't seem to get the required ID from the Calendar Event. The ID I get from Event.getId() doesn't work in those URL's and there is no event.getUrl().

Does anyone know if this is possible with apps script?

like image 580
jankeir Avatar asked May 11 '12 14:05

jankeir


1 Answers

For given event object of type CalendarEvent and given calendarId, the simplest and working way to build an URL to view/edit corresponding event in Google Calendar App is the following:

var splitEventId = event.getId().split('@');
var eventURL = "https://www.google.com/calendar/event?eid=" + Utilities.base64Encode(splitEventId[0] + " " + calendarId);

The best thing is that no Google API invocation, authentication, ... needed!

like image 135
ošky Avatar answered Oct 19 '22 23:10

ošky