Free Support Forum - aspose.com

Wrong end date for recurring event after extraction from the PST


#1

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)


#2

@slavago,

I have observed your comments. Please share your sample PST file with us along with the environment details with us. We’ll look into it for assisting you further.


#3

Hi,
My environment is Linux , CentOS 7.6. Aspose.Email for Java version 19.1. Java 8.

Why do you need sample PST ? I provided code and sample event that shows the problem, even without saving the PST. Just run the sample.

Thanks
calendar.pst.zip (6.0 KB)


#4

@slavago,

I have worked with the sample code shared by you and have been able to observe the issue specified. An issue with ID EMAILJAVA-34505 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.