I've followed the suggestion for adding a VTIMEZONE component to my .ics.
Which works, except when it comes to outlook. Here's my dilemma:
ics is generated correctly. When VTIMEZONE is at the end of the VCALENDAR
(after VEVENT), outlook ignores it. However, when I copy/paste VTIMEZONE
above the first VEVENT it works. My question is: does it really matter
where VTIMEZONE is located in the file (it appears that on outlook for mac
it does). If so, how do I force the VTIMEZONE to write first (above the
VEVENT)?
Here's my code:
StringWriter writer = new StringWriter();
ICalWriter icalWriter = new ICalWriter(writer, ICalVersion.V2_0);
icalWriter.getTimezoneInfo().setGenerator(new TzUrlDotOrgGenerator(true));
//outlook compatibility
TimeZone tz =
TimeZone.getTimeZone(iCal.getEvents().get(0).getDateStart().getParameter(ICalParameters.TZID));
icalWriter.getTimezoneInfo().setDefaultTimeZone(tz);
try
{
icalWriter.write(iCal);
} catch (IOException e)
{
LOGGER.error("unable to write timezone information onto the ical
event", e);
}
String returnCalendarStr = writer.toString();
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Two of everyone's favorite calendaring subjects!
I've followed the suggestion for adding a VTIMEZONE component to my .ics.
Which works, except when it comes to outlook. Here's my dilemma:
ics is generated correctly. When VTIMEZONE is at the end of the VCALENDAR
(after VEVENT), outlook ignores it. However, when I copy/paste VTIMEZONE
above the first VEVENT it works. My question is: does it really matter
where VTIMEZONE is located in the file (it appears that on outlook for mac
it does). If so, how do I force the VTIMEZONE to write first (above the
VEVENT)?
Here's my code:
StringWriter writer = new StringWriter();
ICalWriter icalWriter = new ICalWriter(writer, ICalVersion.V2_0);
icalWriter.getTimezoneInfo().setGenerator(new TzUrlDotOrgGenerator(true));
//outlook compatibility
TimeZone tz =
TimeZone.getTimeZone(iCal.getEvents().get(0).getDateStart().getParameter(ICalParameters.TZID));
icalWriter.getTimezoneInfo().setDefaultTimeZone(tz);
try
{
icalWriter.write(iCal);
} catch (IOException e)
{
LOGGER.error("unable to write timezone information onto the ical
event", e);
}