How to generate the Organizer field with DDay.iCal?

647 views Asked by At

I am using the C# library DDay.iCal and trying to produce the ORGANIZER field as defined in IETF RFC 2445:

ORGANIZER;CN=John Smith:MAILTO:[email protected]

A simple question: how can I do this? I have already tried several alternatives with no success: there is always something wrong with the result.

1

There are 1 answers

0
masa On BEST ANSWER

Answering this myself. This was pretty obvious after studying RFC 2445 (or 5545) more closely:

iCalendar iCal = new iCalendar();
Event ev = iCal.Create<Event>();

ev.Organizer = new Organizer("MAILTO:[email protected]");
ev.Organizer.CommonName = "John Smith";

Ok, the result is not exactly the same:

ORGANIZER;CN="John Smith":MAILTO:[email protected]

However, MS Outlook accepts this format and this is what I was looking after.