I am using https://github.com/rianjs/ical.net with .Net 6 API. I am able to create an event like below.
var calendar = new Calendar();
calendar.AddTimeZone(new VTimeZone("America/Chicago"));
var icalEvent = new CalendarEvent
{
Summary = "David's vacation days",
Description = "Description for event",
Start = new CalDateTime(2022, 12, 12, 15, 0, 0),
End = new CalDateTime(2022, 12, 12, 16, 0, 0)
};
calendar.Events.Add(icalEvent);
var iCalSerializer = new CalendarSerializer();
result = iCalSerializer.SerializeToString(calendar);
This creates a .ics file, opening which creates an event in the calendar.
BEGIN:VCALENDAR PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN VERSION:2.0 BEGIN:VTIMEZONE TZID:America/Chicago X-LIC-LOCATION:America/Chicago END:VTIMEZONE BEGIN:VEVENT DESCRIPTION:Description for event DTEND:20221212T160000 DTSTAMP:20221213T184639Z DTSTART:20221212T150000 SEQUENCE:0 SUMMARY:David's vacation days UID:4aca19e6-a7a8-426c-a488-c2abf789c395 END:VEVENT END:VCALENDAR
I see that if I edit the file and add METHOD:CANCEL, SEQUENCE:1, it opens in outlook with 'Remove from calendar'.
Now, how to do this remove event programmatically? I am hoping iCAL has something instead of me serializing the event to string and add the method etc. to that string manually.