user3523751
user3523751

Reputation: 11

I can't delete events on Google Calendar in PHP

I am trying to delete an event on my Google Calendar but my method is not working.I am still new to php and Google Calendars and don't understand it. Here is my php function:

private function __calendarEventDelete($params) {
        $cal = new _gCal();
        $cal->gCal->calendarService->events->delete('primary', $params->data->OrderConfirmationId);
        var_dump($cal->gCal->calendarService->events->delete('primary', $events->data->OrderConfirmationId));                     
 }

Upvotes: 1

Views: 400

Answers (1)

Christian-G
Christian-G

Reputation: 2361

Google Calendar switched to their v3 API which requires you to authenticate using OAuth 2. Settings this up is far from trivial, but here goes:

  1. Go to the Google Developers Console.
  2. Select a project.
  3. In the sidebar on the left, select APIs & auth. In the list of APIs, make sure the status is ON for the Calendar API
  4. In the sidebar on the left, select Credentials.
  5. Click on Create New Client ID
  6. Set up service account and click on OKAY
  7. Use this service account and it's generated key file to have your app communicate with Google Calendar

There is loads more to figure out, but this should get you started!

Upvotes: 1

Related Questions