How to cancel a calendar event using ics files?

One of our requirements is to create iCalendar (.ics) files and send them by email as an attachment. We use DDay.Ical.dll to create ics files according to:

// Create a new iCalendar iCalendar iCal = new iCalendar(); // Create the event, and add it to the iCalendar Event evt = iCal.Create<Event>(); // Set information about the event evt.Start = new iCalDateTime(SomeStartTime); evt.End = new iCalDateTime(SomeEndTime); evt.Location = "At so and so place"; evt.Description = "Some Description"; evt.Summary = "About Some Subject"; iCal.Method = "PUBLISH"; // Serialize (save) the iCalendar iCalendarSerializer serializer = new iCalendarSerializer(); serializer.Serialize(iCal, @"iCalendar.ics"); 

Full process:

  • User1 create an iCal file for a specific date and time and send it to user2.
  • User2 will open the ics file and accept the invitation. The destination will be created in the User2 LOCAL window.

Now, suppose, for some reason, if the assignment is canceled, then User1 must create an ics file and send it to User2 so that User2 can cancel its event from local Outlook.

How to create such an ics file?

+6
source share
1 answer

The file is created in the same way as the ics source file. The status of the event will be different. The UID will identify the event, and the sequence number will indicate the priority of the update, and then the details of the event (changes or cancellations) will be marked

If you want to change / cancel the event after sending the invitation, you need to determine the event / destination by its UID and allocate a higher SEQUENCE number than the original ics event.

UID (unique identifier): http://tools.ietf.org/html/rfc5545#page-117

Sequence: http://tools.ietf.org/html/rfc5545#page-138

and set the status of the event

  / "CANCELLED" ;Indicates event was cancelled. 

Status: http://tools.ietf.org/html/rfc5545#page-92

oh - and method If you need to send an event cancel, the UID must be the same as the original event, and the component properties must be set to cancel Ex. METHOD: CANCEL STATUS: CANCEL

Of course, this will only “cancel” the event, if the recipient then actually clicks to download / subscribe to one calendar application for the first time. For applications that “signed” the remote ics — the next time they check for “updates,” the update must be processed and overwrite the original event.

+10
source

Source: https://habr.com/ru/post/915499/


All Articles