// performs 100 calls in 5 seconds
private boolean writeEvent(String subject, String body, Date start, Date end, int reminderMinutesBeforeStart,
boolean reminderSet, int busyStatus, String categories, boolean durationIs0, int sensitivity) {
ReleaseManager rm = null;
IDispatch outlook;
IDispatch item;
try {
System.loadLibrary("JCom");
rm = new ReleaseManager();
try {
outlook = new IDispatch(rm, "Outlook.Application");
} catch (jp.ne.so_net.ga2.no_ji.jcom.JComException ex) {
JOptionPane.showMessageDialog(CalendarExportPlugin.getInstance().getBestParentFrame(), mLocalizer.msg(
"noOutlookFound", "MS Outlook is not installed."), Localizer.getLocalization(Localizer.I18N_ERROR),
JOptionPane.WARNING_MESSAGE);
return false;
}
item = (IDispatch) outlook.invoke("CreateItem", IDispatch.PROPERTYGET, new Integer[] { olAppointmentItem });
item.put("Subject", subject);
item.put("Body", body);
item.put("Start", correctTimeZone(start));
item.put("End", correctTimeZone(end));
item.put("ReminderSet", reminderSet);
if (reminderSet) {
item.put("ReminderMinutesBeforeStart", reminderMinutesBeforeStart);
}
item.put("BusyStatus", busyStatus);
item.put("Categories", categories);
if (durationIs0) {
item.put("Duration", 0);
}
item.put("Sensitivity", sensitivity);
item.method("Save", null);
item.release();
outlook.release();
} catch (Exception e) {
e.printStackTrace();
ErrorHandler.handle(mLocalizer
.msg("exportError", "An error occured while creating an appointment in MS Outlook."), e);