diff --git a/src/java/davmail/exchange/VCalendar.java b/src/java/davmail/exchange/VCalendar.java index f030b7d1..2ad28570 100644 --- a/src/java/davmail/exchange/VCalendar.java +++ b/src/java/davmail/exchange/VCalendar.java @@ -179,6 +179,9 @@ public class VCalendar extends VObject { // convert date values to outlook compatible values setServerAllday(vObject.getProperty("DTSTART")); setServerAllday(vObject.getProperty("DTEND")); + } else { + fixTzid(vObject.getProperty("DTSTART")); + fixTzid(vObject.getProperty("DTEND")); } } @@ -190,6 +193,12 @@ public class VCalendar extends VObject { } + private void fixTzid(VProperty property) { + if (property != null && !property.hasParam("TZID")) { + property.addParam("TZID", vTimezone.getPropertyValue("TZID")); + } + } + protected void splitExDate(VObject vObject) { List exDateProperties = vObject.getProperties("EXDATE"); if (exDateProperties != null) { diff --git a/src/test/davmail/caldav/TestCaldav.java b/src/test/davmail/caldav/TestCaldav.java index 7d95ff9c..3297db83 100644 --- a/src/test/davmail/caldav/TestCaldav.java +++ b/src/test/davmail/caldav/TestCaldav.java @@ -149,8 +149,6 @@ public class TestCaldav extends AbstractDavMailTestCase { MultiStatus multiStatus = method.getResponseBodyAsMultiStatus(); MultiStatusResponse[] responses = multiStatus.getResponses(); - Set ITEM_PROPERTIES = new HashSet(); - ITEM_PROPERTIES.add("instancetype"); List events = session.searchEvents("/users/" + session.getEmail() + "/calendar/", session.and( session.gt("dtstart", session.formatSearchDate(start)), diff --git a/src/test/davmail/exchange/TestExchangeSessionEvent.java b/src/test/davmail/exchange/TestExchangeSessionEvent.java index e862300b..dfafbf74 100644 --- a/src/test/davmail/exchange/TestExchangeSessionEvent.java +++ b/src/test/davmail/exchange/TestExchangeSessionEvent.java @@ -276,4 +276,16 @@ public class TestExchangeSessionEvent extends TestCase { System.out.println("'"+BundleMessage.format(status)+"'"); } + public void testMissingTzid() throws IOException { + String itemBody = "BEGIN:VCALENDAR\n" + + "BEGIN:VEVENT\n" + + "DTSTART:20100101T000000\n" + + "DTEND:20100102T000000\n" + + "END:VEVENT\n" + + "END:VCALENDAR"; + String toServer = fixICS(itemBody, false); + System.out.println(toServer); + assertTrue(toServer.contains("DTSTART;TZID=")); + assertTrue(toServer.contains("DTEND;TZID=")); + } }