theFizz
theFizz

Reputation: 23

Google Calendar API: Clear All Events From Secondary Calendar PHP

I'm trying to clear the contents of a secondary Google Calendar in PHP but I see in the API documentation that the clear() method only works on the accounts primary calendar and wont take parameters for a secondary calendar calendar ID. Instead it says to use the delete() method but I do not want to delete the calendar all together, just delete its contents.

//legal 
$service->calendars->clear('primary');
//Illegal
$service->calendars->clear($calendarId);

What would be the most effective way to clearing the events of a secondary calendar in the API?

Upvotes: 2

Views: 1387

Answers (1)

ReyAnthonyRenacia
ReyAnthonyRenacia

Reputation: 17613

You can actually delete events from your secondary calendar like you would in your primary. Use the Events: delete and provide the calendarid and eventId. But, take note that in your secondary calendar, your calendarId is no longer your default email. It's different. (Calendar-> calendar settings -> Calendar Address ) You can give it a Try-it to test this.

Upvotes: 1

Related Questions