I am trying to create secondary calendars for a calendar that is shared with a service account. My code is as follows:
putenv('GOOGLE_APPLICATION_CREDENTIALS='.__DIR__.'/service_account.json');
define('SCOPES', Google_Service_Calendar::CALENDAR);
$client = new Google_Client();
$client->setApplicationName('REdu Calendars');
$client->useApplicationDefaultCredentials();
$client->addScope([SCOPES]);
$client->setAccessType('offline');
$service = new Google_Service_Calendar($client);
$calendar = new Google_Service_Calendar_Calendar();
$calendar->setSummary($userName);
$calendar->setTimeZone('America/Los_Angeles');
$createdCalendar = $service->calendars->insert($calendar);
I think the above code creates a secondary calendar in the service account. What I really want is the ability to create a secondary calendar in the calendar that is shared with the service account. Any help is greatly appreciated.