Remove recurrent event from .ics

535 Views Asked by At

I'm using iCal.net to generate ICS files which are then send via Email. This works perfectly, and the events are properly imported when I click on the ICS file in the attachment.

However, I also want to be able to remove the already imported recurrent events before they are imported. I'm working with an opt-in/opt-out system where users can select days they want to have events on.

So either I need to update the already imported recurrent events, or delete them and re-import.

Right now I'm using this to create the recurrent event:

BEGIN:VCALENDAR
PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN
VERSION:2.0
BEGIN:VEVENT
DTEND:20210104T151500
DTSTAMP:20210105T105450Z
DTSTART:20210104T150000
LOCATION:Online
RRULE:FREQ=DAILY;UNTIL=99991231T235959;BYDAY=4MO,4WE
SEQUENCE:0
SUMMARY:Recurrent event
UID:e39bd24c-1a7f-4eb4-8174-af69d7cd77a7
END:VEVENT
END:VCALENDAR

And I am trying to delete the events with:

BEGIN:VCALENDAR
PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN
VERSION:2.0
BEGIN:VEVENT
METHOD:CANCEL
DTEND:20210104T151500
DTSTAMP:20210105T105450Z
DTSTART:20210104T150000
LOCATION:Online
RRULE:FREQ=DAILY;UNTIL=99991231T235959;BYDAY=4TU,4FR
SEQUENCE:1
SUMMARY:Recurrent event
UID:e39bd24c-1a7f-4eb4-8174-af69d7cd77a7
STATUS:CANCELLED
END:VEVENT
END:VCALENDAR

OR (because deleting isn't working, I need options :D) update the existing event:

BEGIN:VCALENDAR
PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN
VERSION:2.0
BEGIN:VEVENT
DTEND:20210104T151500
DTSTAMP:20210105T105450Z
DTSTART:20210104T150000
LOCATION:Online
RRULE:FREQ=DAILY;UNTIL=99991231T235959;BYDAY=4TU,4FR
SEQUENCE:1
SUMMARY:Recurrent event
UID:e39bd24c-1a7f-4eb4-8174-af69d7cd77a7
END:VEVENT
END:VCALENDAR

The cancel UID's are the same, I have tried with a recurrent-id with DTSTART value.

I have also tried below links: How to delete a single event from a recurring set using ical programmatically? How to cancel an calendar event using ics files? And more like these.

0

There are 0 best solutions below