0

I'm developing google script that uses google apps services and calendar api. Is there a way to get the video call id from CalendarEvent object?

1 Answers1

0

This isn't possible using the default CalendarApp Service, you will need to use the Advanced Calendar Service (which you should enable in the Script Editor by selecting Resources > Advanced Google services... and then enable it in the Google Developers Console.) then you can get the hangoutLink of an event.

Here's an example:

function myFunction() {
  var calendarId = 'calendarId';
  var now = new Date();
  var events = Calendar.Events.list(calendarId, {
    timeMin: now.toISOString(),
    singleEvents: true,
    orderBy: 'startTime',
    maxResults: 10
  });
  if (events.items && events.items.length > 0) {
    for (var i = 0; i < events.items.length; i++) {
      var event = events.items[i];
      Logger.log('%s (%s)', event.summary, event.hangoutLink);
    }
  } else {
    Logger.log('No events found.');
  }
}
ocordova
  • 1,788
  • 2
  • 13
  • 20
  • thanks! And is there a way to get to the advanced calendar service event starting with event object from calendar app service anyhow, or do I have to re-design everything to use advanced calendar service only? – Marcin Smieszek Aug 24 '16 at 07:49
  • Yes, that depends on your use case, for instance you can get all the event details with the default CalendarApp Service, then just create a function to retrieve the `hangoutLink`by the `eventId`. – ocordova Aug 24 '16 at 14:19