Giuseppe Fiorentino
Giuseppe Fiorentino

Reputation: 33

How do I create/change a Google Calendar Event with a given Meet URL using Google Apps Script?

I'm trying to create or update a Google Calendar Event using a previously generated Meet URL. I've tried with something like this:

  var event = eventCal.createEvent(summary, startTime, endTime, options);      
  var eventId = event.getId().split("@")[0];

  var event1 = Calendar.Events.get(calendarId, eventId);
  event1.setHangoutLink(room); //OLD Meet URL
  Calendar.Events.update(event1, calendarId, event1.id);
  var room1 = event1.hangoutLink;

Everything seems to be fine, from the last row I obtain that room1 == room, but the Event gets created with a new Meet URL! The one I get adding:

  var newRoom = Calendar.Events.get(calendarId, eventId).hangoutLink;

after the previous code. I also tried .patch() with the same result. Any hint?

Upvotes: 1

Views: 767

Answers (2)

carbontracking
carbontracking

Reputation: 1089

Perhaps it is possible using the Advanced Calendar service in Apps script which should allow you to access the API

This article shows the use of the Calendar API in Apps Script

On this dev reference page you can see that the conferenceData.conferenceId value can be set to the 10-letter meeting code, for example aaa-bbbb-ccc. Prior to setting this, it appears that you need to set the key type to "hangoutsMeet" in the conferenceData.conferenceSolution object

After all the above, I searched SO again and I find this duplicate question with a full worked answer

Upvotes: 0

ziganotschka
ziganotschka

Reputation: 26836

Unfortunately this is currently not possible

Indeed, the documentation for the event resource specifies:

hangoutLink
An absolute link to the Google+ hangout associated with this event. Read-only.

On Google's Issue Tracker there is already a feature request for implementing the manual setting of the Hangout link. I recommen you to "star" the issue to increase the visibility and receive notifications about the implementaiton of the feature.

Upvotes: 2

Related Questions