Dear Sir/Madam,
is there anyway of creating an ICS file using Aspose for Java?
I’ve seen that it’s possible with C# and VB:
Do you have this feature for Java?
Kind regards,
JP (on behalf of Renato).
Dear Sir/Madam,
Hi JP,
Thank you for writing to Aspose support team.
You can use Aspose.Email for Java to create an ICS appointment file. Please have a look at the following code sample for your kind reference and let us know if we can be of any additional help to you in this regard.
Sample Code:
String sender = "test@gmail.com";
String recipient = "test@email.com";
MailMessagemessage = new MailMessage(sender, recipient, "", "");
Calendar calendar = Calendar.*getInstance*(TimeZone.*getTimeZone*("GMT"));
calendar.set(2012, Calendar.*NOVEMBER* , 1, 0, 0, 0);
Date startDate = calendar.getTime();
calendar.set(2012, Calendar.*DECEMBER* , 1);
Date endDate = calendar.getTime();
MailAddressCollection attendees = **new** MailAddressCollection();
attendees.add("attendee1@domain.com");
WeeklyRecurrencePattern expected = **new** WeeklyRecurrencePattern(3);
Appointment app = **new** Appointment("Appointment Location", "Appointment Summary", "Appointment Description",
startDate, endDate,
**new** MailAddress("organizer_address@aspose.com", "Organizer"), attendees, expected);
//If you don’t want to set the appointment as draft, comment this line
app.setMethod(AppointmentMethodType.*Publish* );
app.save(“TestAppointment.ics”, AppointmentSaveFormat.*Ics* );