简体   繁体   English

将Google日历活动添加到非主日历

[英]Add Google Calendar Event to non Primary calendar

I am trying to add an event to a newly created calendar. 我正在尝试将事件添加到新创建的日历中。 The calendar can be created like so: 日历可以这样创建:

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

Is there anyway to now determine the calendarId? 无论如何,现在可以确定calendarId吗? Right now an event is added to the "primary" calendar. 现在,一个事件已添加到“主要”日历中。

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

How can I add the event to the newly created calendar? 如何将活动添加到新创建的日历中?

I literally just had to solve the same problem: 我实际上只需要解决相同的问题:

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;
            }
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM