1

We can launch Outlook' email by simply using:

Desktop.getDesktop().mail(new java.net.URI("mailto:YourEmailAddress@gmail.com?subject=TEST"));

Is there a similar way to launch an Outlook's new appointment window with some data prefilled? (Not send the new meeting request, just launch the form).

1 Answers1

0

You can use COM from Java under Windows (Jacob) - create an instance of the Outlook.Application object and call CreateItem.

In VB (easy to convert to Java):

set app = CreateObject("Outlook.Application")
set appt = app.CreateItem(1)
appt.Subject = "test appointment"
appt.Body = "Test body"
appt.Start = #08/27/2022#
appt.Display()
Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • I tried: **ActiveXComponent ol = new ActiveXComponent("Outlook.Application");** But it gives error: _ERROR [com.calypso.AWTUNCAUGHT] [-] [] java.lang.NoClassDefFoundError: Could not initialize class com.jacob.com.ComThread_ Though I have the jacob.jar in my buildpath – Kannu Verma Aug 26 '22 at 02:08
  • Do you know any other way to do it? Thanks in advance! – Kannu Verma Aug 26 '22 at 02:25
  • I don't use Java, but is jacob.dll visible to the current process? See https://www.google.com/search?q=java+ActiveXComponent+NoClassDefFoundError – Dmitry Streblechenko Aug 26 '22 at 02:48
  • I am using this instead: Desktop.getDesktop().browse(new URI("outlookcal:addevent?subject=test")) But here the problem is I cannot find other parameters like allDay=true does not work and also body/content/description/summary none of them works for body. – Kannu Verma Aug 31 '22 at 18:30
  • The url is very limited at what it can do. Do use COM automation. – Dmitry Streblechenko Aug 31 '22 at 19:10