Remove deleted e-mails with Flow

With this simple trick, you will truly delete your unwanted e-mails in Outlook.

E-mail on the web

I use Outlook on the web as my mail/calendar client. At some point, I got fed up with .pst issues where the file got corrupted and I had to clean up my machine and set up e-mail again waiting for the whole thing to sync. So one day, I decided to manage my e-mail in the browser. And I never looked back since.

Like with any other app that's a part of Office 365, Outlook on the web became recently the primary target for deploying new capabilities. Sure, there is a case to be made for using fat clients, but for Outlook, they don't apply to me, and so I'm happily living on the web. Well almost, because there is one thing that's been bothering me for a long time.

When delete != delete

We all get a bunch of crap e-mail every day. Outlook does a great job of dividing your messages into relevant and irrelevant. In the end, if you're anything like me, you will want to get rid of the unnecessary ballast and delete messages you don't need.

When you delete a message in Outlook on the web it's moved to the Deleted items folder. I admit it's better than asking Are you really sure? but nevertheless, the e-mail stays there. There is a setting in Outlook that purges deleted items on every logout, but do you actually log out? I know I don't. And so I'm faced with a reminder of 1000+ deleted items.

There is a Flow for that

Microsoft Flow is the Office macros for Office 365. You can use it to automate virtually any tedious task and removing unwanted e-mails is no different. Here's how.

Start with creating a Flow that will run daily.

Next, initialize a variable that you will use to keep the number of deleted items in your Outlook.

Then, until the number of deleted e-mails equals 0, repeat the following steps.

Retrieve the list of e-mails from the Deleted items folder.

Update the number of deleted items in the variable so that the loop will repeat if there are still more items to delete.

For each retrieved e-mail message, delete it, passing its ID as the parameter.

That's it! From now on, all you have to do is to delete unwanted messages and the Flow that you have just built will clean up your deleted items daily for you, without you having to think about it ever again.