icalendar从重复中删除实例 [英] icalendar remove an instance from recurrence

查看:104
本文介绍了icalendar从重复中删除实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Icalendar在用C#开发的门户上创建重复邀请.正文包含有关房间的信息.如果用户创建一个3个房间重复5周的重复活动,则会创建一个重复邀请邀请.但是,如果用户在该重复发生的任何特定日期更新房间信息,我会发送该天的单个邀请,但要从该重复发生的邀请中删除该天,则必须在该特定日期重新创建该5周的单个邀请EXDATE(排除).有没有一种方法可以达到我的目的,从而避免重复一次为期5周的重复邀请,并且从该邀请中排除特定的一天.

I am using Icalendar to create a recurrence invite on a portal developed in C#. the body contains the information of rooms involved. If user creates a recurrence with 3 rooms for 5 week, a single invite for recurrence request got created. But if user updates rooms information for any specific day in that recurrence, I send a single invite for that day but to remove that day from single invite of recurrence, I have to recreate the the single invite for that 5 week with a specific days in EXDATE (exlusion). Is there a way i can achieve this to avoid recreation of the single invite for 5 week recurrence and a specific day is excluded from that invite.

我用于创建重复邀请的代码示例.

sample of code i am using to create single invite for recurrence.

str.AppendLine("BEGIN:VCALENDAR");
str.AppendLine("PRODID:-//Team Test");
str.AppendLine("VERSION:2.0");
str.AppendLine("METHOD:REQUEST");
str.AppendLine("BEGIN:VEVENT");
str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", utcStime)); //utcStime is UTC time
str.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}", DateTime.UtcNow));
str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", utcEtime));////utcEtime is UTC time
str.AppendLine(string.Format("RRULE:FREQ=WEEKLY;COUNT=5"));
str.AppendLine("LOCATION:  ");
str.AppendLine(string.Format("UID:{0}", "Test12345"));
str.AppendLine(string.Format("DESCRIPTION:{0}", msg.Body));
str.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", msg.Body));
str.AppendLine(string.Format("SUMMARY:{0}", msg.Subject));
str.AppendLine(string.Format("ORGANIZER:MAILTO:{0}", msg.From.Address));
for (int i = 0; i < msg.To.Count; i++)
{
    str.AppendLine(string.Format("ATTENDEE;ROLE=REQ-PARTICIPANT;CN=\"{0}\";RSVP=TRUE:mailto:{1}", msg.To[i].DisplayName, msg.To[i].Address));
}
str.AppendLine(string.Format("ATTENDEE;PARTSTAT=ACCEPTED;CN=\"{0}\":mailto:{1}",
str.AppendLine("BEGIN:VALARM");
str.AppendLine("TRIGGER:-PT15M");
str.AppendLine("ACTION:DISPLAY");
str.AppendLine("DESCRIPTION:Reminder");
str.AppendLine("END:VALARM");
str.AppendLine("END:VEVENT");
str.AppendLine("END:VCALENDAR");

System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar");
ct.Parameters.Add("method", "REQUEST");
AlternateView avCal = AlternateView.CreateAlternateViewFromString(str.ToString(), ct);
msg.AlternateViews.Add(avCal);
sc.Send(msg);  // sc is smtpclient i.e. SmtpClient sc = new SmtpClient();

推荐答案

您不必为此异常"创建单独的事件.您只需重新发送您的REQUEST(SEQUENCE属性加1),但是它将包含2个VEVENT组件:

You do not have to create a separate event for this "exception". You simply resend your REQUEST (with a SEQUENCE property bumped by one) but it will contain 2 VEVENT components:

  • 主要VEVENT组件(带有RRULE,不需要EXDATE)
  • 额外的VEVENT组件,其RECURRENCE-ID与您要修改的实例的DTSTART相对应.

另请参见重复事件,如何存储?给出了指向示例的指针.

See also Recurring events, how to store them? which gives pointers to examples.

这篇关于icalendar从重复中删除实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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