Filtering ics calendar export by start date

Heya, I’m trying to export my personal calendar, hosted on a Nextcloud 30.0.7, to an external app, which is a doodle-like thing used in the public administration I’m working for, so that it can filter slots automatically based on my availabilities.

I understand there is currently no way to export only free/busy information other than to internal users of the same instance, and that’s fine. I’m OK with exporting my full calendar to a service that I consider trusted.

Hence I’ve created a sharing link from Nextcloud, which I can download with wget/curl, obtaining a correct vcalendar/ics file. The URL I obtained looks like this: https://cloud.my.domain/remote.php/dav/public-calendars/SOMEMAGICNUMBER?export. The problem is that the returned file is too big for the target service, which only accepts a maximum of ~2 MiB.

Is there a way to produce an export URL that only returns events starting from a given time? I’ve noticed that in the ICSExportPlugin there is a $start parameter, but my attempts to pass it something via an additional query parameter (I’ve tried &start=YYYY-MM-DD) failed thus far. And I’m not even sure that is the code that is behind the ?export endpoint…

Any tips?

Thanks a lot in advance and thanks for Nextcloud, it’s awesome!
Cheers

Nextcloud uses sabredav. See here for how to set a start and end date when exporting a calendar: iCalendar Export Plugin - sabre/dav
Depending on the events in your calendar you also might want to use the expand option.

Hi,
if your main goal is to show your availability (e.g., so others can see when you’re free or book a time slot), have you considered using the Appointments app for Nextcloud?

It lets you define available time slots, manage bookings, and share your availability via a simple link — which might be a more straightforward solution than exporting and filtering .ics files manually.

You can check it out here:
:point_right: https://apps.nextcloud.com/apps/appointments

Might be worth a look depending on your use case.

1 Like

Thanks for this, but it doesn’t work for me. As soon as I add &start=173568600 to my URL above (that’s the UNIX timestamp corresponding to January 1st, 2025) I get a basically empty output, like this and nothing else:

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//SabreDAV//SabreDAV//EN
X-WR-CALNAME:Personal (zack)
X-APPLE-CALENDAR-COLOR:#795AAB
REFRESH-INTERVAL;VALUE=DURATION:PT4H
X-PUBLISHED-TTL:PT4H
END:VCALENDAR

If I also add &expand=1, then I get a ERROR 400: Bad Request. HTTP answer.

(Without either of those extra parameters the export works, but it’s too big for my needs, as mentioned in the original post.)

Does it work for you?

Thanks for your answer. I was already aware of the Appointments app, but, as mentioned in the original post, I need a ics/vcalendar export for an external application, which only “speaks” ics/vcalendar. If Appointments can export a free/busy application, that would work, but last time I checked it didn’t.

Cheers

Oh, I think I understand what’s needed to make this work, even if it doesn’t match the documentation. You always need to specify all three of them: start + end + expand, no matter if you want expand to be true or false, and no matter if you don’t care about the end date. With all three of them, it works! Thanks everyone.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.