Hi,
in our code we need to add event to the PST and later on to extract it (to add then recurrence exceptions).
When I extract the event I get Date : Sun Jan 02 00:00:00 UTC 4501.
Please this code and the attached event :
MapiConversionOptions options = new MapiConversionOptions(OutlookMessageFormat.Unicode);
options.setUseBodyCompression(false);
PersonalStorage pst = PersonalStorage.create("/tmp/calendar.pst", FileFormatVersion.Unicode);
FolderInfo tmpFolder = pst.createPredefinedFolder("Calendar", StandardIpmFolder.Appointments);
Appointment appt = Appointment.load("/tmp/event.ical");
final MailMessage msg = new MailMessage();
msg.addAlternateView(appt.requestApointment());
final MapiMessage mapi = MapiMessage.fromMailMessage(msg, options);
final MapiCalendar tmpCal = (MapiCalendar) mapi.toMapiMessageItem();
tmpCal.setAllDay(true);
System.out.println("Date start (original): " + tmpCal.getRecurrence().getRecurrencePattern().getStartDate());
System.out.println("Date end (original): " + tmpCal.getRecurrence().getRecurrencePattern().getEndDate());
String id = tmpFolder.addMapiMessageItem(tmpCal);
IMapiMessageItem tmpMsg = MapiMessage.fromMailMessage(pst.extractMessage(id).toMailMessage(new MailConversionOptions()), options).toMapiMessageItem();
if (tmpMsg instanceof MapiCalendar) {
System.out.println("Date start (after extract): " +((MapiCalendar) tmpMsg).getRecurrence().getRecurrencePattern().getStartDate());
System.out.println("Date end (after extract): " +((MapiCalendar) tmpMsg).getRecurrence().getRecurrencePattern().getEndDate());
}
pst.dispose();
The result of this run is:
Date start (original): Mon Jun 25 00:00:00 UTC 2012
Date end (original): Fri Jun 29 00:00:00 UTC 2012
Date start (after extract): Mon Jun 25 00:00:00 UTC 2012
Date end (after extract): Sun Jan 02 00:00:00 UTC 4501
Thanks.
event.ical.zip (1.2 KB)