如何使用 ics 文件取消日历事件? [英] How to cancel an calendar event using ics files?

查看:43
本文介绍了如何使用 ics 文件取消日历事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的要求之一是创建 iCalendar 文件 (.ics) 并将它们作为附件通过电子邮件发送.我们正在使用 DDay.Ical.dll 来创建 ics 文件,如下所示:

One of our requirements is to create iCalendar files (.ics) and send them each in emails as an attachment. We are using DDay.Ical.dll to create ics files as under:

// 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");

完整的流程是:

  1. 用户 1 为特定日期和时间创建 iCal 文件并将其发送给用户 2.
  2. User2 将打开 ics 文件并接受邀请.将在 User2 的本地 Outlook 中创建约会项目.

现在,假设由于任何原因,如果约会被取消,那么用户 1 必须创建一个 ics 文件并将其发送给用户 2,以便用户 2 可以从本地 Outlook 中取消他的事件.

Now, Suppose, because of any reason if appointment is cancelled, then User1 HAS to create an ics file and send it to User2, so that User2 can cancel his event from the local outlook.

如何创建这样的 ics 文件?

How to create such ics file?

推荐答案

文件的创建方式与原始 ics 文件相同.事件状态会有所不同.UID 会识别事件,序号会指示更新的优先级,然后会记录事件的详细信息(更改或取消)

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

如果您在发出邀请后想要更改/取消某个活动,您需要通过其 UID 来识别该活动/约会,并分配一个比原始 ics 活动更大的序列号.

If you want to change/cancel an event after sending out an invitation, you need to identify the event/appointment by its UID, and allocate a bigger SEQUENCE number than the original ics event.

UID(唯一标识符):https://www.rfc-editor.org/rfc/rfc5545#page-117

UID (unique identifier) : https://www.rfc-editor.org/rfc/rfc5545#page-117

序列:https://www.rfc-editor.org/rfc/rfc5545#page-138

并设置事件状态

             / "CANCELLED"    ;Indicates event was cancelled.

状态:https://www.rfc-editor.org/rfc/rfc5545#page-92

哦——还有方法如果您需要为事件发送取消,UID 应与原始事件相同,并且组件属性应设置为取消 Ex.方法:取消状态:已取消

oh - and method If you need to send in a cancellation for an event the UID should be same as the original event and the component properties should be set to cancel Ex. METHOD:CANCEL STATUS:CANCELLED

当然,这只会取消"该事件,前提是接收者实际上在第一次点击以将其加载/订阅到同一日历应用程序中.对于已订阅"远程 ics 的应用程序 - 当他们下次执行更新"检查时,应处理更新并覆盖原始事件.

Of course this will only 'cancel' the event if the recipient then actually clicks to load/subscribe it into the same calendar app as the first time. For applications that have 'subscribed' the the remote ics - when they next do an 'update' check the update should be processed and overwrite the original event.

这篇关于如何使用 ics 文件取消日历事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆