Why aren't secondary calendars created with the Google Library showing up in My Calendars?
Here is my code:
$summary="summary test";
$description="description test";
$location="Barcelona";
$timezone="Europe/Madrid";
$calendar = new Google_Service_Calendar_Calendar();
$calendar->setSummary($summary);
$calendar->setDescription($description);
$calendar->setLocation($location);
$calendar->setTimeZone($timezone);
echo "<br>1- calendari creat<br>";
$newCalendar = $service->calendars->insert($calendar);
With this, I am successfully creating a new calendar as I am getting a valid calendar object in $ newCalendar and can also pull it out specifying the calendars. The problem is that I can see the calendar on the calendars interface uner "My Calendars".
To get a list of calendars I use:
$service->calendarList->listCalendarList();
And I get all the calendars including the one I just created, but I don't see them in the My Calendars list.
+3
source to share
1 answer
You have correctly created a new calendar, but you forgot that you need to insert into the calendar list
$calendarListEntry = new CalendarListEntry();
$calendarListEntry->setId("calendarId");
$createdCalendarListEntry = $service->calendarList->insert($calendarListEntry);
Calendars are not included in the calendar list until they are added to it. I'm sure there is a good reason for this. I haven't found her yet.
+1
source to share