Free Support Forum - aspose.com

ICS File is not get open after creating using Aspose.Email for JAVA API

Hi,
I have created ICS Calendar using MapiCalendar. After creating ICS file is not get opened. I have shared created ICS File. Please check the issue and let me know the exact solution. I am waiting for your response.

@kharade.a,

We have tested creating sample ICS file using MapiCalendar and it opens fine in MS Outlook. Please share your sample code for generating ICS file for further investigation at our end.

Sample Code

// Create the appointment
MapiCalendar appointment = new MapiCalendar();
appointment.setLocation("LAKE ARGYLE WA 6743");
appointment.setSubject("Appointment");
appointment.setBody("This is a very important meeting");

Date startDate = null;
Calendar cal = GregorianCalendar.getInstance();
cal.set(2016, 10, 2);
startDate = cal.getTime();

Date endDate = null;
cal = GregorianCalendar.getInstance();
cal.set(2016, 10, 3);
endDate = cal.getTime();

appointment.setStartDate(startDate);
appointment.setEndDate(endDate);

appointment.save(dataDir + "CalendarItem_out.ics", AppointmentSaveFormat.Ics);