There’s the adage that email is where productivity dies, and I believe it, so having an action in Power Automate that helps us keep our inbox in check is a godsend. Outlook 365 “Delete email” action will do as it says. Deletes any email we provide, so let’s check how to use it.
Where to find it?
To find it, you need to go to “Standard”
Find “Office 365 Outlook” (you may need to expand to find it)
Select the “Delete email” action.
Here’s what it looks like:
Now that we know how to find it let’s understand how to use it.
It’s pretty simple how to do it. You provide the “Message Id” that you want to delete, and that’s it. Email gone.
Microsoft did a great job simplifying a super complex action, but let’s look at the fields individually because there are some caveats that you should be aware of.
The message ID is something that you need to fetch from somewhere. It’s not something deterministic that you can calculate, so it’s usual provider by another action or trigger. For example, if you have the trigger, “When a new email arrives”, you’ll automatically get the email ID you can use in the deletion. This goes for any action that fetches emails, like “Get Emails”.
The “Delete Email” action won’t be able to delete your email without this, and it will fail if you can’t find an email with that ID.
Another important note is that the ID is independent of where the email is. You don’t have a different ID if the email is moved from the inbox to another folder, for example, so you can consider that the ID follows the email in your mailbox.
Finally, some actions return “Conversation Id” or even “ID”. Don’t be confused because these are different than the ones we want to delete the email. So be sure always to use the “Message ID” when deleting an email.
Original Mailbox Address
You don’t need to fill in this field unless you want to access another mailbox. The default folder list will always be yours. This field is here so you can define shared mailboxes, for example, and access the list of folders it contains.
You need to have permission to access a shared mailbox before you can move the email. You won’t be able to configure any permission in the “Delete Email” action since they are configured centrally, so consult with your administrator if there’s something wrong. A good rule is if you can see the shared mailbox in your desktop version of Outlook, then you have permissions. This is not a limitation but generates some issues when trying to use the action.
Here are some things to keep in mind.
Use it wisely
Having emails automatically deleted can be good, but you must ensure that the rules you have in place to figure out what email should be deleted are rock solid. There’s nothing worse than deleting an email without you knowing about it or deleting something important. Also, please remember that this action is permanent and without any notification. You can build one in your Flow, but be careful.
Name it correctly
The name is super important in this case since we’re doing something drastic (deleting an email), so it should be clear why we’re doing it. Always build the name so that other people can understand what you are using without the need to open the action and check the details.
Always add a comment.
Adding a comment will also help avoid mistakes. Indicate the reasoning for deleting the email and what the rules are to do so. It’s essential to enable faster debugging when something goes wrong.
Always deal with errors.
Have your Flow fail graciously and notify someone that something failed. It’s horrible to have failing Flows in Power Automate since they may go unlooked-for a while or generate even worse errors. I have a template that you can use to help you make your Flow resistant to issues. You can check all details here.
Back to the Power Automate Action Reference.