If you want to create a meeting in the organizer calendar I'd suggest automating Outlook from your Java-based application. You may consider using the Ole automation technology for automating Outlook, for example:
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.ole.win32.OLE;
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.OleClientSite;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.swt.ole.win32.Variant;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class OutlookMail {
public static void main(String[] args) {
sendEMail();
}
public static void sendEMail() {
Display display = new Display();
Shell shell = new Shell(display);
OleFrame frame = new OleFrame(shell, SWT.NONE);
// This should start outlook if it is not running yet
// OleClientSite site = new OleClientSite(frame, SWT.NONE, "OVCtl.OVCtl");
// site.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
// Now get the outlook application
OleClientSite site2 = new OleClientSite(frame, SWT.NONE, "Outlook.Application");
OleAutomation outlook = new OleAutomation(site2);
OleAutomation mail = invoke(outlook, "CreateItem", 0 /* Mail item */).getAutomation();
setProperty(mail, "BodyFormat", 2 /* HTML */);
setProperty(mail, "Subject", "My test subject");
// setProperty(mail, "From", "my@sender.org");
setProperty(mail, "To", "<John Doe> my@recipient.org");
setProperty(mail, "HtmlBody", "<html><body>This is an <b>HTML</b> test body.</body></html>");
// if (null != attachmentPaths) {
// for (String attachmentPath : attachmentPaths) {
// File file = new File(attachmentPath);
// if (file.exists()) {
// OleAutomation attachments = getProperty(mail, "Attachments");
// invoke(attachments, "Add", attachmentPath);
// }
// }
// }
invoke(mail, "Display" /* or "Send" */);
}
private static OleAutomation getProperty(OleAutomation auto, String name) {
Variant varResult = auto.getProperty(property(auto, name));
if (varResult != null && varResult.getType() != OLE.VT_EMPTY) {
OleAutomation result = varResult.getAutomation();
varResult.dispose();
return result;
}
return null;
}
private static Variant invoke(OleAutomation auto, String command,
String value) {
return auto.invoke(property(auto, command),
new Variant[] { new Variant(value) });
}
private static Variant invoke(OleAutomation auto, String command) {
return auto.invoke(property(auto, command));
}
private static Variant invoke(OleAutomation auto, String command, int value) {
return auto.invoke(property(auto, command),
new Variant[] { new Variant(value) });
}
private static boolean setProperty(OleAutomation auto, String name,
String value) {
return auto.setProperty(property(auto, name), new Variant(value));
}
private static boolean setProperty(OleAutomation auto, String name,
int value) {
return auto.setProperty(property(auto, name), new Variant(value));
}
private static int property(OleAutomation auto, String name) {
return auto.getIDsOfNames(new String[] { name })[0];
}
}
See How to create an E-Mail in Outlook and make it visible for the User for more information.
The sequence of property and method calls from the Outlook object model you can find in the following articles: