cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MarcusD1
Helper I
Helper I

Remove duplicate emails from inbox?

I have a problem I though Power Automate would be perfect for, but I can find any existing Flow solutions for it.

 

I receive many dozens of duplicate emails a day in my Outlook inbox as a result of being included on more than one distro list, and/or part of a "redirect" rule. This obviously clogs up my inbox and causes all kinds of headaches. Since I can't really control which distro lists or redirect rules I'm placed on, I was hoping there was a way to have a rule that when an email arrives, it checks my inbox and if that email already exists, it deletes the new one (or sends it to a subfolder, etc.).

 

Is this even theoretically possible with PA?

8 REPLIES 8
ScottShearer
Super User
Super User

@MarcusD1 

Please see my example below and let me know if this is what you need.  Please note the single quotes in my search filter.

image.png

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
barret
Resolver II
Resolver II

You could definitely come up with something that could accomplish this. The tricky part would be creating the logic that determines what defines an email as a duplicate. You can do something like:

 

When a new email arrives, compare against the last 50 emails or something and if the subject and first 50 characters of the body match any of those emails, delete it or move it to subfolder.

 

You won't be able to compare the from or to addresses if some of them are to distros or forwarded from another account. And you'll have to strip things like FWD or something like that from subject lines for forwarded emails and so forth. But it definitely could be done.

I implemented this and let it run over the weekend. It's failing in the Conditional. Doesn't like the logic expression.

 

MarcusD1_0-1637601817961.png

 

This is the expression I have in the Condition:

length(outputs('Get_emails_(V3)')?['body'])

MarcusD1_1-1637601937313.png

 

Did I typo something?

 

@MarcusD1 

Your expression should reference body/value rather than body.  You should have selected Value rather than Body from Dynamic properties.

image.png

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

I fixed the expression, but now it's applying it to every email. My "If yes" action was set to move the duplicate into a sub-folder (or at least that was my intention), but since making the edit to the expression, every email is being moved into the sub-folder. Unfortunately, given the week, I haven't received any duplicates yet since making the correction - so I'm not sure yet how those are behaving.

@MarcusD1 

First, turn off your Flow so that it doesn't do any damage or cause you work.

Then, please post a screen shot of the Flow.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Yeah... I've certainly done that before (caused damage and/or created a lot of clean up for myself). 😁 But minimal impact so far this time.

 

Here's my screen shots:

MarcusD1_3-1637616611436.png

 

MarcusD1_2-1637616533754.png

The full text of the expression is: 

length(outputs('Get_emails_(V3)')?['body/value'])

 

MarcusD1_1-1637616476146.png

 

... and thank you for your continued help with this Scott. I just signed up for a "How to Use Flow Expressions" course on Udemy, but I'm not there yet.

jowe1989
New Member

Hi Scott

I tried it too and it is like Marcus said. It always delete all mails and not just the duplicated ones. I didnt found any solution to handle it.

Best regards

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

Users online (3,656)