Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DDay iCal - adding an Attendee

How does one add required/optional attendees + organizer(s) to an iCal event?

I'm using the excellent DDay library, and would love to be able to also add a CN, but haven't found any examples in the documentation, the downloaded examples or elsewhere.

Thanks!

like image 684
seekay Avatar asked Oct 13 '11 00:10

seekay


2 Answers

I got a solution. Not very neat but its working for me.

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:[email protected]")
{
    CommonName = "Naveen Jose",
    Role = "REQ-PARTICIPANT"
};
attendes.Add(attendee1);
//optional attendee
IAttendee attendee2 = new DDay.iCal.Attendee("MAILTO:[email protected]")
{
    CommonName = "Noah Naveen",
    Role = "OPT-PARTICIPANT"
};
attendes.Add(attendee2);
if (attendes != null && attendes.Count > 0)
{
    evt.Attendees = attendes;
}
like image 160
naveen Avatar answered Nov 04 '22 19:11

naveen


You could also use RSVP = true to prompt for a reply from the attendee

IAttendee attendee1 = new DDay.iCal.Attendee("MAILTO:[email protected]")
{
    CommonName = "Naveen Jose",
    Role = "REQ-PARTICIPANT",
    RSVP = true
};
like image 40
RogerG Avatar answered Nov 04 '22 18:11

RogerG