DDay iCal - 添加参加者

时间:2011-10-13 00:48:54

标签: asp.net-mvc icalendar dday

如何将必需/可选的与会者+组织者添加到iCal活动中?

我正在使用优秀的DDay库,并希望能够add a CN,但未在documentation,下载的示例或其他地方找到任何示例。

谢谢!

2 个答案:

答案 0 :(得分:9)

我有一个解决方案。不是很整洁,但它为我工作。

iCalendar calendar = new iCalendar();
calendar.Method = "PUBLISH";

Event evt = calendar.Create<Event>();

var attendes = new List<IAttendee>();
//required attendee
IAttendee attendee1 = new DDay.iCal.Attendee("MAILTO:myid@gmail.com")
{
    CommonName = "Naveen Jose",
    Role = "REQ-PARTICIPANT"
};
attendes.Add(attendee1);
//optional attendee
IAttendee attendee2 = new DDay.iCal.Attendee("MAILTO:someid@codovations.com")
{
    CommonName = "Noah Naveen",
    Role = "OPT-PARTICIPANT"
};
attendes.Add(attendee2);
if (attendes != null && attendes.Count > 0)
{
    evt.Attendees = attendes;
}

答案 1 :(得分:2)

您还可以使用RSVP = true来提示与会者的回复

IAttendee attendee1 = new DDay.iCal.Attendee("MAILTO:myid@gmail.com")
{
    CommonName = "Naveen Jose",
    Role = "REQ-PARTICIPANT",
    RSVP = true
};