【发布时间】:2021-07-04 10:34:00
【问题描述】:
如标题中所述,我想通过 Javascript 中的 Google 日历 API 获取 Google 日历中事件的位置。因此我使用了 Google API 示例。
/**
* 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.');
}
});
}
现在不起作用的部分是“位置”。我能够获得接下来 10 个日历事件的日期和名称,但不能获得位置。有谁知道如何做到这一点?提前致谢!!
【问题讨论】:
标签: javascript api location google-calendar-api