Creating iCals in C # and this CodeProject post say you should use the DDay iCal library .
DDay.iCal is the iCal class library (RFC 5545) for .NET 2.0 and higher, Silverlight. It aims to be as compatible with RFC 5545 as possible, while focusing on compatibility with popular calendar applications such as Apple iCal, Outlook 2007, etc.
Some sample code iCal + MVC + DDay.iCal
public ActionResult iCalendar(string DownloadFileName) { DDay.iCal.iCalendar iCal = new DDay.iCal.iCalendar(); Event evt = iCal.Create<Event>(); evt.Start = iCalDateTime.Today.AddHours(8); evt.End = evt.Start.AddHours(18); // This also sets the duration evt.Description = "The event description"; evt.Location = "Event location"; evt.Summary = "18 hour event summary"; evt = iCal.Create<Event>(); evt.Start = iCalDateTime.Today.AddDays(5); evt.End = evt.Start.AddDays(1); evt.IsAllDay = true; evt.Summary = "All-day event"; ISerializationContext ctx = new SerializationContext(); ISerializerFactory factory = new DDay.iCal.Serialization.iCalendar.SerializerFactory(); IStringSerializer serializer = factory.Build(iCal.GetType(), ctx) as IStringSerializer; string output = serializer.SerializeToString(iCal); var contentType = "text/calendar"; var bytes = Encoding.UTF8.GetBytes(output); return File(bytes, contentType, DownloadFileName); }
source share