添加Google日历事件到非主日历

Add Google Calendar Event to non Primary calendar

本文关键字:日历 事件 Google 添加      更新时间:2023-09-26

我正在尝试将事件添加到新创建的日历中。日历可以这样创建:

gapi.client.calendar.calendars.insert(
 {
     "resource" :
     {"summary": "Test Cal",
     "description": "test",
     "timezone" : "xxxx"}
 });

现在是否有办法确定日历?现在一个事件被添加到"主"日历。

var request=gapi.client.calendar.events.insert({
             "calendarId": "primary",
             resource:{
                 "summary":.....

如何将事件添加到新创建的日历中?

我只需要解决同样的问题:

var calendarID;
var req = gapi.client.calendar.calendarList.list({});
    req.execute(function(resp) {
        for (var i = 0; i < resp.items.length; i++) {
            if (resp.items[i].summary === "Newly Created Schedule") {
                console.log("Newly Created Schedule ID: " + resp.items[i].id);
                calendarID = resp.items[i].id;
                break;
            }
        }