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

Copper 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/...

20 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.
deeplinkmail.gif

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
https://learn.microsoft.com/en-us/graph/api/user-post-messages?view=graph-rest-1.0&tabs=http
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 -

MeghanaMSFT_2-1668687257701.png

 

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

MeghanaMSFT_0-1668687173984.png

2) Directly pasting deeplink in browser

MeghanaMSFT_1-1668687220382.png

 

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.

We raised a bug for the same, we will keep you posted on the updates. Thank you.

@Meghana-MSFT , do you have any update on this bug?
Or any ETA for the update?

Unfortunately, we currently do not have update/ETA on this bug. Please be assured that we will keep you posted on the updates of the bug. Thanks.
@Meghana-MSFT , do you have update on the bug or progress of the same?
we currently do not have update/ETA on this bug. We are continuously checking for updates with team. We will keep you posted on the updates of the bug. Thanks.

@maheshkumaryu - We got the below response from the Outlook team. 

 

"This is using a pre-Teams app web URL format that deep links into OWA. It is recommended to use “Mail” capability in the JS SDK, which is the most structured/strongly typed way to support this scenario." 

 

 Thanks

@Meghana-MSFT - Thanks for the confirmation from the Outlook team.
Can you please provide an example to perform this in the SDK approach if I have an ItemID that I can pass to an API and let the browser open the Outlook window in Compose mode ?

@maheshkumaryu - Could you please check the below samples that show how to call the compose deeplink 

 

this is a good and expected Compose deeplink

https://outlook-sdf.office.com/mail/deeplink/compose/AAkALgAAAAAAHYQDEapmEc2byACqAC-EWg0APEbLv6Yv6Ee...

this is a good and expected Read deeplink

https://outlook-sdf.office.com/mail/deeplink/?ItemID=AAkALgAAAAAAHYQDEapmEc2byACqAC-EWg0APEbLv6Yv6Ee...

this is a little bit of a mix-and-match and ... not quite right. you're likely to run into some unexpectedness with this link

https://outlook-sdf.office.com/mail/deeplink/compose/AAkALgAAAAAAHYQDEapmEc2byACqAC-EWg0APEbLv6Yv6Ee...


Could you please use the correct compose deeplink syntax and confirm if that helps?