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?
I noticed there are two type of event ID's, when creating a series of events, there is only one link that you can pass on arguments of the
yyyy/mm/dd
, the other one will ignore the given date and will just default in todays date.Look at this calendar: https://calendar.google.com/calendar/embed?src=vpaacademy.com_id182o7e82j7f4es5jrefink2g%40group.calendar.google.com&ctz=America%2FNew_York
Go to November and Click on 'Computer class' event, click on "More details" it will bring you to: https://calendar.google.com/calendar/r/month/2018/10/29?eid=MWVqMjBjYmFhMGVrMnA3YTB0bGN0ajJjNzhfMjAxODEwMjlUMjMzMDAwWiB2cGFhY2FkZW15LmNvbV9pZDE4Mm83ZTgyajdmNGVzNWpyZWZpbmsyZ0Bn&ctz=America/New_York&sf=true
but by retriving the Bas64 of the eid it returns https://calendar.google.com/calendar/r/month/2018/10/29?eid=MWVqMjBjYmFhMGVrMnA3YTB0bGN0ajJjNzggdnBhYWNhZGVteS5jb21faWQxODJvN2U4Mmo3ZjRlczVqcmVmaW5rMmdAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ= which ignores the date passed in, how can I get that ID?
It is indeed not possible. There's an enhancement request on apps script issue tracker that mentions this misfeature. You may want to start it to keep track of updates and kind of vote for it.
Issue 627: GAS for Appointments
For given
event
object of type CalendarEvent and givencalendarId
, the simplest and working way to build an URL to view/edit corresponding event in Google Calendar App is the following:The best thing is that no Google API invocation, authentication, ... needed!
The new version of Google Calendar has broken this. Here's how to fix it: