Does (and how) Calendar store revisions or backups of calendars, if an app goes haywire

It happened to me before that (an) Akonadi(-based application) ate all my tasks in the local .ics file. And that more than once! Luckily I have backups.

I now moved all these tasks (~600 in total) to my Nextcloud server and am now wondering:

  • if that app goes haywire again (I don’t know which one and why) and tried to purge my tasks, would this delete them from the Nextcloud server too, since it’s synced via WebDAV?
  • does Nextcloud keep a copy of the last n revisions of the calendars on it (and why not, it sounds just as likely someone would mess something up in a calendar than in a file)
  • how can I set it up to have regular backups/snapshots/revisions of the calendars (incl. tasks)?

If a caldav-synced client deletes tasks - those deletions get synced to Nextcloud server. There is a trashbin for caldav though (introduced with Nextcloud 22.0) which is enabled by default. After a configurable period of time (default: 30 days) items get deleted from the trashbin.

No, as far as I know Nextcloud doesn’t keep different revisions of calendars (except for the trashbin mentioned before). The activity app shows calendar changes though.

You could use calcardbackup. Have a look at the README in the repo for creating regular calendar/adressbook-backups (including tasks).

For Calendar backup the Android (And I’m presuming the IPhone) app has a Contacts and calendar backup function. Hamburger menu → Settings → Contacts & calendar backup. This will create a .Calendar-Backup folder and a .Contacts-Backup folder, these will then get regular dumps in them of backups. I’m fairly sure this is a client side backup, no idea why it’s not implemented server side tbh. Unfortunately it looks like the VTODO are missing from the ICS files.

As @Bernie_O suggested using a script is a good way of doing it and to get everything I have used the cli tool cadaver in the past.

Create a .cadaverrc to automate your task

open https://example.tld/remote.php/dav/calendars/<<your user name>>/
mget <<your calendar name>>/*
logout
quit

create a ~/.netrc to automate your login credentials

machine example.tld
login <<your user name>>
passwd <<your app password>>

Then you just have a simple bash script you can throw into a cronjob

#! /bin bash

RC_FILE=~/.cadaverrc
BACKUP_FOLDER=~/
BACKUP_NAME=$(date '+%Y-%m-%d')

TEMP_FOLDER=$(mktemp -d)
cd $TEMP_FOLDER
caldaver  -r ${RC_FILE}
cat ./*.ics > ${BACKUP_FOLDER}${BACKUP_NAME}.ics
exit

Thank you both. These are all very useful solutions.

If I undestand correctly, OotB, Nextcloud nowadays also puts the removed tasks into the trash even if they were deleted by one of the CalDAV clients?

If so, that should solve my usecase already.

Is there a way to batch-restore things from the Trash? Clicking 600 × on a button for each of the todos does seem very tedious.

Yes.

Not that I know of - except for fiddling around directly in the database (which I would not recommend).

I just tested it and it works in practice too. Sweet!

Hmmm, I’d be willing to throw a bit of coin towards someone making Trash (or a separate app to handle it) where you can select a time range or a certain MIME type etc. to batch restore big booboos.

Well, I just experienced it again, so I’m willing to bet it’s an Akonadi-based problem.

I noticed all my 600+ todos disappeared (apart from the todo calendar that was shared with another NextCloud user). Oddly enough this affected only todos, but not calendar events.

I could recover them, by restoring each of them individually through Tasks ↦ Trash. It was a tedious process, but I go through it.

What I worry about though is that in the process I was greeted with a handful (probably a dozen, maybe two) errors saying that a task was not able to be recovered. I could not find any detail about which task that would be, even after looking through the logs.