【发布时间】:2020-07-26 08:08:31
【问题描述】:
ical 附件 (.ics) 适用于除每周重复和每月一次的案例之外的所有案例。我正在尝试为一个工作日创建每周重复一次,并为每个月的最后一个星期二/第二个星期二创建每月重复一次。当我打开 .ics 文件时,它显示“操作失败”。
每周:
evnt.Start = new CalDateTime(start);
evnt.End = new CalDateTime(new DateTime(evnt.Start.Year, evnt.Start.Month, evnt.Start.Day, end.Hour, end.Minute, end.Second));
rrule = new RecurrencePattern(FrequencyType.Weekly, 1);
rrule.ByDay.Add(new WeekDay(DayOfWeek.Monday));
rrule.Until = end;
evnt.RecurrenceRules = new List<RecurrencePattern> { rrule };
每月:
evnt.Start = new CalDateTime(start);
evnt.End = new CalDateTime(new DateTime(evnt.Start.Year, evnt.Start.Month, evnt.Start.Day, end.Hour, end.Minute, end.Second));
rrule = new RecurrencePattern(FrequencyType.Monthly,1);
rrule.Until = end;
rrule.ByDay.Add(new WeekDay(DayOfWeek.Sunday,FrequencyOccurrence.FifthToLast));
evnt.RecurrenceRules = new List<RecurrencePattern> { rrule };
请让我知道我做错了什么。
【问题讨论】:
-
您的 DTSTART 是否符合重复规则?
-
在文本中您将每月重复描述为 FREQ=MONTHLY;INTERVAL=1;BYDAY=2TU,-1TU 但在代码中您有星期日?
标签: c# asp.net outlook icalendar