Delete a bunch of events at once

We have a user with a dozens of copies of an appointment in his calender. It would be nice to be able to delete all these events at once. Deleting it one by one would take him hours. Is it possible to delete a bunch of events at once, either via the browser or even with a script or via the database?

Unfortunately, I’m not aware about such a function. It might be possible that things will change with the publishing of the Calendar app v2.0 but that hasn’t confirmed yet. In the meantime I would recommend to use Thunderbird/Lightning to subscribe to that calendar and delete the events there.

Thank you for the feedback. TB/Lightning is already the way we go.

Though it’s a bit tricky, you could try to delete the calendar objects directly in the database. The events are stored in at least two parts:

  1. in oc_calendarobjects_props
  2. in oc_calendarobjects

In my case I first allocated the calendar ID I wanted to delete from looking at table oc_calenders. It turned out to be ID 19

Then I crafted a query for the oc_calendarobjects_props like:

SELECT objectid FROM oc_calendarobjects_props WHERE calendarid = 19

In addition you can add other criteria there as well. In my case

SELECT objectid FROM oc_calendarobjects_props WHERE calendarid = 19 and id>= 8995

this gave me all the recently added events to the calendar with ID 19

Now comes the tricky part. You want to delete all the items from oc_calendarobjects which relate to any of these object IDs.

This can be done with the “where exists” statement like

DELETE FROM oc_calendarobjects
WHERE EXISTS (SELECT *
              FROM oc_calendarobjects_props
              WHERE oc_calendarobjects_props.objectid = oc_calendarobjects.id
                AND oc_calendarobjects_props.calendarid = 19
                AND oc_calendarobjects_props.id >= 8895
)

As I have done this query already some hours ago, I’m not sure if the above syntax is correct. It’s just an idea for future needs.