Search code examples
google-calendar-apicaldav

How to find out deletion time of an event with CalDAV?


Problem description

I am using CalDAV to sync events between Google Calendar and my own calendar application. Right now i am trying to implement Deletion and Restore functionality:

Every time something is synced between my two systems, i write (meta)info about the synced event in a json file. So using that file i am able to tell in a particular moment which event were synced already and are not anymore present in the CalDAV side (Google Calendar in my current case, but could be any Calendar service that support CalDAV). So, telling if an already-synced event was deleted on the CalDAV side is no problem. Now i would like to know WHEN did the deletion take place.


What i have tried

So far i tried simply retrieving all events with

<?xml version=\"1.0\" encoding=\"utf-8\"?><d:propfind xmlns:d=\"DAV:\" xmlns:cs=\"http://calendarserver.org/ns/\"><d:prop><d:getetag /></d:prop></d:propfind>

But this only returns information about the existing (not deleted) items.

Also i tried retrieving the deleted event using its id with:

<?xml version=\"1.0\" encoding=\"utf-8\"?><c:calendar-multiget xmlns:d=\"DAV:\" xmlns:c=\"urn:ietf:params:xml:ns:caldav\"><d:prop><d:getetag /><c:calendar-data/></d:prop><d:href>{eventName}</d:href></c:calendar-multiget>

But this returns HTTP 404.


Does anyone know (or has any suggestion on) how to find out the deletion time of an event using CalDAV?


UPDATE

I found out that using Google Calendar API it is possible to retrieve a list of all the documents, and this list could include deleted ones by setting the property showDeleted to true.

But the question remains:

Does anyone know how could i implement something like this with CalDAV?


Solution

  • Deletion is a peculiarity of Google Calendar, and not necessarily supported by all other calendars, that is why it is not possible to obtain deletion information using just CalDAV.

    You could use GoogleCalendar API to take advantage of the deletion information for that particular case while implementing CalDAV in your application: It would be something like Server-Specific functionality.