Zend GData delete events in a range on non-primary calendar

735 views Asked by At

How can I programmatically delete events in a secondary calendar in Google calendar for a specific date range? I have been searching for a few days now and all the tutorials and questions answered so far only show how you can delete on the default calendar. Has anyone got an example of how I can delete events from a non-default calendar?

1

There are 1 answers

0
Rasika On BEST ANSWER

It's a bit odd to answer my own question. But it might help someone else to save a lot of time. The hint was from this post.

Basically, when you are searching for the events to be deleted, how you set the non-default calendar is by changing the setUser part from

$query->setUser('default');

to

$query->setUser($UserPartFromSecondaryCalendarID);

The calendar ID for secondary calendars are in the form of http://www.google.com/calendar/feeds/default/XXXXXXXXXX. What you should be passing for $UserPartFromSecondaryCalendarID is XXXXXXXXXX. This can be easily achieved by splitting the calendar ID by '/' and getting the last element (6).