Search code examples
javascriptoutlookoutlook-addinoutlook-web-addins

How to open email in Outlook using the Outlook addon?


I'm developing add-in where part of functionality is reminder. User entered some data and set what this email will be sent for example tomorrow.
My idea/task is to make possible what on pressing for example btn in my add-in it will open in Outlook(online one and desktop) the needed email. What I have is id of the email that I need re-open in outlook. Is it possible if you know emails id in outlook open it again by add-in? Scheme or request

Any ideas?

Btw I am using in my project newest version of office.js.api library for rest calls to Outlook. Also I know that in using gmail functionality you can open in same page needed email if you know its id.


Solution

  • Thanks to "Outlook Add-ins Team - MSFT" answer was found. The answer is using this function displayMessageFormAsync() Be aware it uses as first prm ItemId member. more info here

    Like so

    let emailID ='AQMkADAwATMwMAItNGIxMy0yYTAyLTAwAi0wMAoARgAAA5vuE8DX1vtBmAIURe25AdEHAENSlH9y8y9Jqcjhmi7n76AAAAIBCQAAAENSlH9y8y9Jqcjhmi7n76AAAAAJEhewAAAA'
     Office.context.mailbox.displayMessageFormAsync(emailID, function (asyncResult) {
      console.log("Result: " + JSON.stringify(asyncResult));
     });
    

    It opens it like so enter image description here