Reputation: 473
I have successfully integrated with Google Calendar using PHP with a Service Account.
What I can do:
What I can not do:
Here is the entire code that I use to accomplish everything so far:
putenv('GOOGLE_APPLICATION_CREDENTIALS=credentials.json');
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->setScopes('https://www.googleapis.com/auth/calendar');
$client->setSubject('[email protected]');
$service = new Google_Service_Calendar($client);
$calendarID = 'primary';
$eventID = 'XXXXXXXXX';
$event = new Google_Service_Calendar_Event(array(
'sendNotifications' => true,
'attendees' => array(
array('email' => '[email protected])
)
));
$event = $service->events->patch($calendarID, $eventID, $event);
Upvotes: 2
Views: 1987
Reputation: 533
Late to the party but since there are no answers...
I've just been having this exact same problem. Few things:
sendNotifications
is deprecated, you should be using sendUpdates instead.$event = $service->events->patch(
$calendarID,
$eventID,
$event,
['sendUpdates' => 'all']
);
Upvotes: 6