Martin Bielak
Martin Bielak

Reputation: 206

Build link (url) for calendar event

I want to build a url link from event, so I can use this url in my web app as a clickable link. After click on event I want to see opened event, where I can edit this event I found this, but its not working correctly:

var calendarId = CalendarApp.getCalendarById(MYCAL).getId();

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

Output (eventURL) is URL:

https://calendar.google.com/calendar/r/eventedit/MGtxajM4bjZnaDljdGZrczloNzdlZmFsM3IgbWFydGluLmJpZWxhazFAZ21haWwuY29t

But original URL to event is :

https://calendar.google.com/calendar/r/eventedit/MGtxajM4bjZnaDljdGZrczloNzdlZmFsM3IgbWFydGluLmJpZWxhazFAbQ

It is almost matching, but end of URL is different. I tried also without space between splitEventId and calendarId, but output was worst. Does somebody know, why this is happening? How can I build,get event URL?

Thanks.

Upvotes: 0

Views: 800

Answers (2)

MαπμQμαπkγVπ.0
MαπμQμαπkγVπ.0

Reputation: 6729

You can try the Events: get

HTTP request

GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId

Important parameters needed:

calendarId - Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.

eventId - Event identifier.

You can also use the Try it now to check if you have provided a valid/correct data for the required parameters.

Upvotes: 1

Sudhi
Sudhi

Reputation: 91

This link will help you: Google Calender v3

And the way to build this url is:

GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId

where calendarId & eventId are parametres.

Hope this is helpfull.

Upvotes: 1

Related Questions