I am trying to rewrite an outdated application that I have not previously written using the Google Calendar v3 API.
I implemented the google-api-php client, created an API key in my developer console and went through the authentication process. I have an accessToken that I save in the database, and when it expires, I can update this token well.
However, I canβt work with calendars at all.
I keep track of what limited documentation already exists and has the following:
$this->client = new Google_Client(); $this->client->setClientId( $this->settings['clientId'] ); $this->client->setClientSecret( $this->settings['clientSecret'] ); $this->client->setAccessToken( $this->settings['accessToken'] ); $service = new Google_Service_Calendar($this->client); $calendarList = $service->calendarList->listCalendarList(); while(true) { foreach ($calendarList->getItems() as $calendarListEntry) { echo $calendarListEntry->getSummary(); } $pageToken = $calendarList->getNextPageToken(); if ($pageToken) { $optParams = array('pageToken' => $pageToken); $calendarList = $service->calendarList->listCalendarList($optParams); } else { break; } }
The error I am getting is:
Message: Undefined property: Google_Service_Calendar_CalendarList::$items
I checked my Google Calendar account and all calendars are shared, so there shouldn't be a problem, although I donβt understand why this is a problem, because I use an authenticated account anyway.
Anyone who can offer advice?
Many thanks
source share