I'm using this code to add an Event to my Calendar
$client = new Google_Client();
$client->setApplicationName("Calendar");
$scopes = array('https://www.googleapis.com/auth/prediction', 'https://www.googleapis.com/auth/calendar');
$auth_credentials = new Google_Auth_AssertionCredentials(SERVICE_ACCOUNT_NAME, $scopes, $privateKey);
$client->setAssertionCredentials($auth_credentials);
$client->setClientId(CLIENT_ID);
$cal = new Google_Service_Calendar($client);
try {
$event = new Google_Service_Calendar_Event();
$event->setSummary('Halloween');
$event->setLocation('The Neighbourhood');
$start = new Google_Service_Calendar_EventDateTime();
$start->setDateTime('2014-01-09T10:00:00.000-05:00');
$event->setStart($start);
$end = new Google_Service_Calendar_EventDateTime();
$end->setDateTime('2014-01-10T10:25:00.000-05:00');
$event->setEnd($end);
$createdEvent = $cal->events->insert('primary', $event);
echo $createdEvent->getId()."\n\n";
}
catch (Exception $ex)
{
die($ex->getMessage());
}
I get the Event ID, it is printed out, but when I look at my calendar in a browser - there is absolutely nothing.
What am I doing wrong?