2

We're planning to create draft Outlook 365 emails from our ASP.NET MVC C# code which is running as an Azure App. That looks relatively straightforward in the Outlook Mail REST API documentation and there's some useful info on that in this reply too.

What I'd then like to do is open that message in Outlook 365 in a new browser tab so the user can edit it before pushing send, but I can't seem to find a way to do that?

So, the process I'm trying to achieve is:

  1. Create draft message in O365 Outlook using the Rest API
  2. Save that draft
  3. Open a new browser tab displaying that saved draft message in Outlook 365

Step 3 is what I can't find a way to do, is it possible?

If I open an email in Outlook 365 the URL is generic and doesn't contain a unique ID for the message object, so I'm not sure if there's any way to get a URL that links directly to an email message?

tomRedox
  • 28,092
  • 24
  • 117
  • 154

2 Answers2

3

Alternatively if they're using on prem Outlook you could create a hyperlink using mailto: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_link_mailto

I have subsequently found this which should meet your criteria:

https://stackoverflow.com/a/40477920/4528266

https://blogs.msdn.microsoft.com/carloshm/2016/01/16/how-to-compose-a-new-message-or-event-and-populate-fields-in-office365/#comment-1645

simpleman
  • 153
  • 7
  • That's definitely a good start. I guess there are a couple of potential issues with it: adding email attachments and also that the message isn't secure as it's forming part of the URL, which could be an issue in light of GDPR – tomRedox Jul 04 '18 at 08:30
2

If you need to keep the mail item after it is shown to a user you need to provide the UI in your application and use REST API for sending it. So, you will be able to refer to the item later.

As a possible workaround you may consider automating the desktop edition of Outlook installed on the machine. See C# app automates Outlook (CSAutomateOutlook) for more information.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • Thanks @Eugene Astafiev - sorry, my question wasn't very clear originally, this is all ASP code so I don't have access to the local copy of Outlook (and indeed there may not be one for some of our clients if they are working from public computers) – tomRedox Jul 03 '18 at 22:05
  • Then you need to provide a custom UI for composing emails on your pages. \ – Eugene Astafiev Jul 03 '18 at 22:14