How to get the location of an event in Google Calendar through the Google Calendar API in Javascript?

as mentioned in the title I would like to get the location of an event in Google Calendar through the Google Calendar API in Javascript. Therefore I used the Google API sample.

/**
 * Print the summary and start datetime/date of the next ten events in
 * the authorized user's calendar. If no events are found an
 * appropriate message is printed.
 */
function listUpcomingEvents() {
    gapi.client.calendar.events.list({
        'calendarId': 'primary',
        'timeMin': (new Date()).toISOString(),
        'showDeleted': false,
        'singleEvents': true,
        'location': '--4-Bikini Bottom (12)',
        'maxResults': 10,
        'orderBy': 'startTime'


    }).then(function (response) {
        var events = response.result.items;
        appendPre('Upcoming events:');

        if (events.length > 0) {
            for (i = 0; i < events.length; i++) {
                var event = events[i];
                var when = event.start.dateTime;
                if (!when) {
                    when = event.start.date;
                }
                appendPre(event.summary + ' (' + when + ')')
            }
        } else {
            appendPre('No upcoming events found.');
        }
    });
}

Now the part that does not work is 'location'. I am able to get the dates and name of the next 10 calendar events but not the location. Does anyone know how to do this? Thanks in advance!!



Read more here: https://stackoverflow.com/questions/67005967/how-to-get-the-location-of-an-event-in-google-calendar-through-the-google-calend

Content Attribution

This content was originally published by Julian Roma at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: