Reputation: 293
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? 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?
Upvotes: 0
Views: 706
Reputation: 305
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;
}
}
Upvotes: 1