New events directly created on iCloud.com are not getting parsed by ical.net

102 views Asked by At
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Asia/Calcutta
X-LIC-LOCATION:Asia/Calcutta
BEGIN:STANDARD
DTSTART:18800101T000000
RDATE;VALUE=DATE-TIME:18800101T000000
TZNAME:HMT
TZOFFSETFROM:+055328
TZOFFSETTO:+055320
END:STANDARD
BEGIN:STANDARD
DTSTART:19411001T000000
RDATE;VALUE=DATE-TIME:19411001T000000
TZNAME:BURT
TZOFFSETFROM:+055320
TZOFFSETTO:+0630
END:STANDARD
BEGIN:STANDARD
DTSTART:19420515T000000
RDATE;VALUE=DATE-TIME:19420515T000000
RDATE;VALUE=DATE-TIME:19451015T000000
TZNAME:IST
TZOFFSETFROM:+0630
TZOFFSETTO:+0530
END:STANDARD
BEGIN:STANDARD
DTSTART:19420901T000000
RDATE;VALUE=DATE-TIME:19420901T000000
TZNAME:IST
TZOFFSETFROM:+0530
TZOFFSETTO:+0630
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
SUMMARY:New Event
UID:D1A9EEAF-AAE9-44B1-92B9-33A620779FA6
DTSTART;X-VOBJ-ORIGINAL-TZID=Asia/Calcutta:20170118T120000Z
DTEND;X-VOBJ-ORIGINAL-TZID=Asia/Calcutta:20170118T130000Z
END:VEVENT
END:VCALENDAR

Above is the ics for new event created on iCloud. I came across with a problem while fetching events from iCloud. Problem is that the event that are directly created on iCloud are not getting parsed using ical.net. While that are being parsed by dday.ical. Event created using ical.net are parsed correctly. Above ics is parsed correctly by DDay.iCal.

Using ical.net
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(ics))
IICalendarCollection calendars = Calendar.LoadFromStream(stream, Encoding.UTF8);

Error comes at Calendar.LoadFromStream and error is String was not recognized as a valid DateTime.

Using Dday.iCal
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(ics))
IICalendarCollection calendars = iCalendar.LoadFromStream(stream, Encoding.UTF8);

Above code of Dday works fine for same ics.

2

There are 2 answers

0
Priyank Kotiyal On

Problem this with VTIMEZONE component which is not getting parsed by ical.net. When we create request for get all meetings we ask for properties of event we want in response. If not needed then remove timezone component from request i.e don't ask for timezone component. Remove from your request. Thanks

0
Priyank Kotiyal On

When I saw this I was using version 2.2.30 which was latest at that time. This problem is solved in version 2.2.31 and fix will be available for higher version as well. See release note for version 2.2.31 : https://github.com/rianjs/ical.net/blob/master/release-notes.md

I have checked this on latest for now i.e 2.2.33 and it is working fine now.