Get link (url) to calendar event in Google script applications

I have a Calendar Event in Google Apps Script, and I want to allow the user to open it by clicking the Anchor button. I think the URL should look like this: http://www.google.com/calendar/event?eid=SOMEID&ctz=Etc/GMT . However, I cannot get the required identifier from the calendar event. The identifier that I get from Event.getId () does not work in these URLs and there is no event.getUrl ().

Does anyone know if this is possible with script applications?

+5
source share
3 answers

With a given eventobject of type CalendarEvent and a given calendarId, simplest and most efficient way to create a URL for viewing / editing, the corresponding event in the Google Calendar application is as follows:

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

Best of all, no API call, authentication and ... are necessary!

+12
source

The new version of Google Calendar has broken this. Here's how to fix it:

var mycal = 'username@m'
var splitEventId = event.getId().split('@');
var eventUrl = "https://www.google.com/calendar/event?eid=" + 
Utilities.base64Encode(splitEventId[0] + " " + mycal).toString().replace('=','');
+1
source

. script, . , .

627:

0

All Articles