This is a long-overdue article from me. I wrote an article a while ago about generating a link to an email, but I’ve received a few emails and comments asking how to do this in a shared mailbox.
Let me start by saying that there’s no ideal solution, or at least none that I’m aware of, but I’ll do my best to show you a few solutions that could work for you, depending on your requirements.
Let’s take a look at the limitations and then the approaches.
A severe limitation first of all
The URL won’t survive moving the email. If you move the email, the identifier will slightly change, and you won’t see the email again when you use the link. I tried 3 different ways to get the URL; all of them work, but after moving the file to a folder and back, it will never work again. You’ll always get this default error message.

I haven’t found a solution yet that will survive the file’s move, so if you have one, please let me know, and I’ll feature you on this site as a hero for finding it.
Approaches
Here are three approaches to getting the URL. You can pick the one that makes more sense to you. The first two are similar, but I wanted to feature the third because it came from someone who commented on the website and wanted to feature that response. Thanks, Curt :).
To test, use the “When a new email arrives in a shared mailbox (V2)” trigger. We need to map it to the shared mailbox like this:

We will use this shared inbox email in some of the approaches, so keep it because it will come in handy.
Link
Let’s start with a simple one where you can generate using the “item id”.
https://outlook.office365.com/owa/?ItemID=[ITEM_ID]&exvsurl=1&viewmodel=ReadMessageItem
Expression:
replace(outputs('Approach_1'),'[ITEM_ID]',encodeUriComponent(triggerOutputs()?['body/Id']))
You’ll be replacing the ”[ITEM_ID]” using the ”replace” function to get the correct ID in the URL.
Let’s break this down:
- Replace the ”[ITEM_ID]” with the ID that we get from the trigger using the ”replace” function.
- “encodeUriComponent” function. This is a precaution since some IDs may contain characters that don’t play well in URLs. I’ve done some tests and managed to get the URL working without it, but I would include it just in case.
The ”[ITEM_ID]” is a placeholder so you can use anything that makes sense, as long as it’s unique.
Deep Link (similar to the previous one)
This solution comes from “Curt” in the article’s comment sections : generate a link to an email. It also works for shared mailboxes.
https://outlook.office.com/mail/[SHARED_MAILBOX]/deeplink?ItemID=[ITEM_ID]&exvsurl=1
The idea is to generate a deep link to the email using the shared mailbox as a reference. To use it, you will need the ”replace” function to fill in the gaps.
replace(replace(<insert here the action that contains the template>,'[ITEM_ID]',encodeUriComponent(triggerOutputs()?['body/Id'])),'[SHARED_MAILBOX]','<insert email here>')
In my case I’m using a compose action so you can do something like this:
replace(replace(outputs('Approach_1'),'[ITEM_ID]',encodeUriComponent(triggerOutputs()?['body/Id'])),'[SHARED_MAILBOX]','<insert email here>')
Let’s break this down:
- Replace the ”[ITEM_ID]” with the id that we get from the trigger using the ”replace” function.
- Replace the “[SHARED_MAILBOX]” with the inbox email, nesting the ”replace” function, by using the output of the previous one.
- “encodeUriComponent” function. Same as before. This is a precaution since some IDs may contain characters that don’t play well in URLs. I’ve done some tests and managed to get the URL working without it, but I would include it just in case.
As before, both ”[ITEM_ID]” and “[SHARED_MAILBOX]” are placeholders, so use whatever makes sense to you. They must only be unique so that the ”replace” function works.
From Graph API (the light at the end of the tunnel )
I’m including some options, but this is quite complex. You can use the Graph API to perform requests that are otherwise not possible in Power Automate. I won’t dwell on the Graph API since it takes a few steps to set up and is outside the scope of the article, but I’ll drop a link when I publish something about how to set it up.
You can use Graph Explorer to check your tasks before moving them to Power Automate, but you can use the following endpoint to get your emails:
https://graph.microsoft.com/v1.0/users/<shared mail email>/messages
You’ll get a list of emails, each with a “webLink.” Notice that the weblink is similar to the one we generated in the previous section, so you can save that link.
This is a good place to demonstrate that the link changes when we change the folder. Here’s an example:
{
<removed for clarity>
"id": "AQMkADQxNjdhOWJmLTQwZjAtNDU1AGYtOTY3Yy1jNWU0MzlmYjZlOTUARgAAA__vaX6m-3hBmLkw_R9YHe0HAKk8atv9LydBpAmk-HHTt9oAAAIBDAAAAKk8atv9LydBpAmk-HHTt9oAAAIFYwAAAA==",
<removed for clarity>
"webLink": "https://outlook.office365.com/owa/?ItemID=AQMkADQxNjdhOWJmLTQwZjAtNDU1AGYtOTY3Yy1jNWU0MzlmYjZlOTUARgAAA%2B%2BvaX6m%2F3hBmLkw%2BR9YHe0HAKk8atv9LydBpAmk%2FHHTt9oAAAIBDAAAAKk8atv9LydBpAmk%2FHHTt9oAAAIFYwAAAA%3D%3D&exvsurl=1&viewmodel=ReadMessageItem",
The item ID is that long number
AQMkADQxNjdhOWJmLTQwZjAtNDU1AGYtOTY3Yy1jNWU0MzlmYjZlOTUARgAAA%2B%2BvaX6m%2F3hBmLkw%2BR9YHe0HAKk8atv9LydBpAmk%2FHHTt9oAAAIBDAAAAKk8atv9LydBpAmk%2FHHTt9oAAAIFYwAAAA%3D%3D
Now let’s move to another folder and back to the inbox. Here’s what we get:
{
<removed for clarity>
"id": "AQMkADQxNjdhOWJmLTQwZjAtNDU1AGYtOTY3Yy1jNWU0MzlmYjZlOTUARgAAA__vaX6m-3hBmLkw_R9YHe0HAKk8atv9LydBpAmk-HHTt9oAAAIBDAAAAKk8atv9LydBpAmk-HHTt9oAAAIFZAAAAA==",
<removed for clarity>
"webLink": "https://outlook.office365.com/owa/?ItemID=AQMkADQxNjdhOWJmLTQwZjAtNDU1AGYtOTY3Yy1jNWU0MzlmYjZlOTUARgAAA%2B%2BvaX6m%2F3hBmLkw%2BR9YHe0HAKk8atv9LydBpAmk%2FHHTt9oAAAIBDAAAAKk8atv9LydBpAmk%2FHHTt9oAAAIFZAAAAA%3D%3D&exvsurl=1&viewmodel=ReadMessageItem",
The link has now the “Item ID” as:
AQMkADQxNjdhOWJmLTQwZjAtNDU1AGYtOTY3Yy1jNWU0MzlmYjZlOTUARgAAA%2B%2BvaX6m%2F3hBmLkw%2BR9YHe0HAKk8atv9LydBpAmk%2FHHTt9oAAAIBDAAAAKk8atv9LydBpAmk%2FHHTt9oAAAIFZAAAAA%3D%3D
Let’s compare both side and we can see that the ID in the URL is different:

You can call the API again and get the new “webLink” to use, but you would need a way to keep the links updated in case the user makes any changes.
Using this strategy, you could consider not event saving the link and querying Graph API every time you need to get a URL. If this would be possible for your workflow, then take advantage of it since it would be the only way to always get a functional URL.
Final Thoughts
So far, there’s not a good solution (at the time of writing and as far as I’m aware) for this persistent problem to change. If you know of a solution, please let me know. People ask about this often, and it could be helpful to everyone, so I’ll test it and publish it here.
I’m providing three choices to give you some flexibility on what makes sense. The first two are comparable, but I understand that the last one could be much more complex to achieve without the added value of a lasting link.
I’m almost sure that this article will be updated frequently as I find new ways to achieve this or find a final solution.
You can follow me on Mastodon (new account), Twitter (I’m getting out, but there are still a few people who are worth following) or LinkedIn. Or email works fine as well 🙂
Photo by Karan Suthar on Unsplash