title: How to create an E-Mail in Outlook and make it visible for the User
body: <p>I want to create an E-Mail with a Java Application using Outlook and the OLE Client.</p>
  
  <p>I searched for examples and found quite a few. They all start the same way:</p>
  
  <p>Create the Display, the Shell, the OLE Frame and the OLE Client Site. </p>
  
  <p>But I get an error with these few steps:</p>
  
  <pre><code>Display display = new Display();
  Shell shell = new Shell(display);
  
  shell.setText("Outlook Automation");
  shell.setLayout(new FillLayout());
  
  OleFrame frm = new OleFrame(shell, SWT.NONE);
  
  OleClientSite site = new OleClientSite(frm, SWT.NONE,
                  "Outlook.Application");
  </code></pre>
  
  <p>I get the following Error:</p>
  
  <pre><code>Exception in thread "main" org.eclipse.swt.SWTException: Failed to create Ole Client. result = -2147221164
  at org.eclipse.swt.ole.win32.OLE.error(OLE.java:302)
  at org.eclipse.swt.ole.win32.OleClientSite.&lt;init&gt;(OleClientSite.java:242)
  at outlooktest.Main.main(Main.java:27)
  </code></pre>
  
  <p>I don't know OLE and I'm not sure what I am doing wrong. Are there some dependencies I'm missing? Does somebody know what this error could be? I googled for the Error code but didn't find anything.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Well if nobody knows why OLE doesn't work for me I've got another question. Is it possible, or is there a Library, to create an Outlook E-Mail and set it up (subject, body etc) but not send it but make it visible for the User to change things?</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>The x86 and x64 jar files didn't work out, same error. Also I got the newest versions of SWT for x86 and x64. OS is x64 and java, too, so I can't use the x86 SWT libraries. With the x64 the error above occurs. The Outlook version is 15 (Outlook 2013). </p>
  
  <p>Hopefully this helps? </p>
  
  <p>I got the creation of E-Mail to work via Processbuilder  but only with the mailto: parameter. The problem here is the folllowing:</p>
  
  <ul>
  <li>I want to track the status of the Process. I want to know when the E-Mail is closed/send whatsoever. </li>
  <li>I want to insert a picture (BufferedImage) out of the Clipboard into the Body, which is simply impossible with the mailto argument.</li>
  </ul>