ComObject alternative for the New Outlook Preview app

412 Views Asked by At

Our organisation is migrating to Office 365, this means mail will be available via Exchange Online so user can access there mail via the webbrowser but also via the "New Outlook Preview" app in Windows 10/11.

A suggestion that has been made is to stop working in the old Outlook 2016 desktop app. But this brings implications with so automation apps. For example there are some (CRM) apps that use the Desktop Outlook Comobject in order to open a new mail in the user mailbox and prefill it with (HTML) content. As far as i know this isn't supported with the "New Outlook Preview" app. Alternative was to rework this to MailTo functions, but these don't support HTML body's (and we need it)

Does some of you out there have the same problem and how did you fixed it?

Update 2023-07-14 Due to some tips and hours of searching on the internet i have two workable solutions. Not ideal but they come close as a replacement of the Outlook COM object.

  1. Mailto and clipboard This one was the easiest. I use the MailTo protocol to open Outlook with a new draft mail, prefilled with To and Subject. Then i style a HTML as a string and then put it on the clipboard (in C#) telling the clipboard it has HTML as data. Now the user only has to put the cursor in the body and hit Paste. Voila done! Two downsides are:
  • Not having option to apply attachments
  • User forgets it has a pre styled body on the clipboard
  1. Graph API I managed to create a draft including HTML body and attachments. It even returns a deeplink where you can open de draft directly in the web browser. This also has two downsides for me:
  • The link is opened in the default webbrowser and not in the new outlook preview
  • The user has to click edit in order to start working. There a lot of topics out there with deeplink URI scheme's in other to edit/compose a email in OWA but non of them work. Due to the lag of documentation i wasn't able to get this to work.

Hopefully MSFT keeps working of "One /Monarch Outlook Preview" for desktop to enrich it with automation functions...

2

There are 2 best solutions below

5
On

Do not stop using the desktop version of Outlook. The new Outlook is a replacement for Windows Mail and Calendar, not for the desktop version of Outlook (which is part of the Office suite).

4
On

Outlook for desktop is still a part of the Microsoft Office package and is not going to retire in near future. So, you may continue relying on the COM automation technology.

However, there is no other trivial way to compose items with HTML bodies and then show to users with a project Monarch (new Outlook). Since you are using a web browser you can provide a form on the web page to create the email. On the backend side you can use the Graph API for that. See Outlook mail API overview and Explainer: How does the Microsoft Graph API send mail? for more information.