Environment variables in shared mailbox trigger/action

Environment variables are supported for many actions like SharePoint Online, Dataverse and so on.

It can happen that sometimes you cannot select the environment variable in your flow, which gives the impression that you cannot use environment variables there.

A good example of such a trigger is the “When a new email arrives in a shared mailbox (V2)” trigger. You cannot add dynamic content in the “Orginal Mailbox Address” field using the UI.

This can be solved. Make sure that you create an environment variable to store the shared mailbox email address. It can be of data type “Text”.

Open your flow, add a “Compose” action and add the environment variable to it.

Copy the “Compose” content into the shared mailbox action.

You will see that the @parameter expression will appear.

It’s not finished yet. Click “Peek code”.

You will see that two “@” characters appear. This is not what we want as this will lead to the flow not recognizing the environment variables. Only with one “@” character, the parameter expression will be recognized.

The trick here is to put a space in front of your expression.

Click “Peek code” again and you’ll notice that the second “@” character is gone.

Don’t forget to save your flow. After refreshing the page, you’ll see that the @parameter value has been changed into real dynamic content.

This limitation has been escalated to the Microsoft product group, so I hope that I can soon announce the good news that we can just add dynamic content into the shared mailbox action without doing complex workarounds.

In the meantime, you are unblocked and you can use environment variables within shared mailbox actions.

This logic should be reusable for other actions which don’t support dynamic content yet.

Leave a Reply

Your email address will not be published. Required fields are marked *