Search code examples
c#icalendarvcalendar

API or Library to process vCalendar information?


I don't have the expertise in timezone conversion to parse a vCalendar file - extracting some of the information is simple but trying to resolve the start and finish times taking timezones and daylight saving into account is not easy and there's no point reinventing the wheel.

Does anyone know of a library of functions into which you can pass an .ICS file and it returns various bits of information?

Eg:

GetStartTimeCorrectedForMyLocalTimezone("c:\c192837.ics")

would return the start time of the event in my local timezone.


Solution

  • I haven't tried them but there are libraries at:
    http://sourceforge.net/projects/icalparser/ and
    http://www.ddaysoftware.com/Pages/Projects/DDay.iCal/

    On the page http://csharpdotnet-aditikothari.blogspot.de/2013/01/ics-fileicalendar-attached-with-email.html there is a bit of information on how the format can be parsed manually.

    But if your main problem is the timezone then if I am correct the times are all UTC in ics

    DateTime localTime = DateTime.SpecifyKind(DateTime.Parse(strDate),  
                                              DateTimeKind.UTC).ToLocalTime();