Outlook Deeplink opens a email compose window in draft state only for the first time

Occasional Contributor

I am using the Outlook compose deeplink to open a new email in compose window from my react application with window.Open(deeplink), however for the very first time a new browser window is opened with new email in Draft state.
If I use the same compose deeplink again from the same browser, then it opens the new email in compose mode as expected.
It feels there is some issue with the cache/cookie storing the OpenID Connect token that gets loaded when I open outlook with the deeplink for first time, and other times it opens the compose email window properly.

Also when I already have Outlook opened in browser and then if I open new browser window from my React application using the deeplink, it works alright.

Deeplink - https://outlook.office.com/mail/deeplink/compose/...

10 Replies
Can you please confirm if you are developing any Teams application. Based on the description it does not seem like a Teams application.
Yes this is one of a functionality in our teams application
We have to open the outlook compose window pre-populating with email address in To, CC
And the subject field

@maheshkumaryu - Could you please share which document you are referring to? In this create deep links doc, there is no such syntax that you mentioned. Can you please share code snippet that you are referring to?

@maheshkumaryu - We tried to open the above shared deeplink using window.open() and

microsoftTeams.app.openLink() and see the below behavior. There is no difference in how the deeplink is opened for the first and second time.

This is the syntax I am trying to open - https://outlook.office.com/mail/deeplink/compose/{emailItemId}?ItemID={emailItemId}&exvsurl=1
Can you please try to open the same link from an incognito window?
Can you please let me know how you are fetching the emailitemId? Can you please share a reference document. Thanks.
This is the graph API we call to generate the email item id
From the response body, the 'id' property is the email item id i use with the outlook compose deeplink

@maheshkumaryu - We created a draft message and got the id. We added the itemid to the deeplink and see the below behavior -



1) Opening from Teams- 1st time and 2nd time


2) Directly pasting deeplink in browser



Yes, this is the exact issue we are facing
We need to open the deeplink from Teams, I suspect this is because of the cookie where the outlook token is being stored
Maybe when we open the deeplink for the first time, it doesn't get the proper token.
However, on second try this works
Do you see what can be the issue here?

@maheshkumaryu - We see the mail in draft state only even after opening it second time, can you also share a video of this issue if possible.