web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Has Attachment - email
Power Automate
Unanswered

Has Attachment - email

(0) ShareShare
ReportReport
Posted on by 158

I built a flow that watches an Outlook mailbox for emails. Any email that has an attachment has the attachment saved in a folder. Any email that doesn't have an attachment has the message body saved in a file in a different folder. The part of the flow that saves the attachments works perfectly. The part of the flow that saves the message body never works. This is what the condition block looks like

sammary_0-1715713193208.png

In other words, the Has Attachment never returns a False. I have tried testing the length of the attachment and using the Boolean function ('True' and 'False) with the same results. Some of the comments in these blogs seem to indicate that Has Attachment maybe "broken" and CoPilot seems to "think" that it isn't really looking at the attachment.

 

Does anyone have any thoughts on how to resolve my issue?

 

Thanks

Sam

Categories:
I have the same question (0)
  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @sammary 

     

    The reason why it is saying Has Attachments = True always is because the email may contains images which it considered as inline attachments (attached with email body), that is the reason why has attachments appears true, to handle this, see below

     

    Use filter array to filter the attachments details with removing the inline attachments from it 

    Nived_Nambiar_0-1715714370567.png

     

    Now use the filter array's output to check whether attachments exists with the mail or not like below

    Nived_Nambiar_1-1715714431889.png

     

    If the above condition is true- that means no attachments, so you can export the email

    if false, save each file as attachment- remember to use output from filter array as it contains non-inline attachments 

    Nived_Nambiar_2-1715714547259.png

     

     

    Hope it helps !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • sammary Profile Picture
    158 on at

    This great but I'm not sure of how the flow works.

    In your version the mail comes in gets filtered and then the condition decides if there is an attachment or not. In this scenario what if I have more than 1 email coming into the Outlook inbox? Where does the Apply to Each go such that all emails are processed?

    Thank you very much

     

  • sammary Profile Picture
    158 on at

    This is my new flow based on your advice and how I understood the flow to work

    sammary_0-1715779114418.png

    Where the Filter array looks like this (Boolean is set to False) and the condition is set like this

    sammary_1-1715779152295.pngsammary_2-1715779168603.png

    After running a test this is what I get

    sammary_3-1715779216365.png

    I made no changes to the Apply to each box.

    Obviously I didn't follow your advice correctly.

     

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @sammary 

     

    could you share details of error- also please follow my flow design, that can help !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • sammary Profile Picture
    158 on at

    Hi Nived,

    I have been out of the office for a few days and was unable to work on this project. Hopefully, later this week I will get a chance to review your suggested changes. That said, in looking at them quickly I don't see how the changes allow for multiple emails to be processed. Hopefully once I implement your suggestions I will have a better understanding of how the flow works.

     

    I really appreciate your help as this is all new to me and not as obvious as I thought it would be.

    Sam

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @sammary 

     

    the flow works trigger wise when email arrives in mailbox, so when another email arrives- another instance of flow will starts.

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • sammary Profile Picture
    158 on at

    Nived,

    I finally finished my other project and I'm back to Power Automate.

    I'm trying to replicate the flow in the False branch that you are suggesting but I'm having some issues:

    - In the Apply to Each function is not showing me Body for the Filter, I'm seeing Attachment. How do I get to see body?

    - In the True branch I have selected Export email (V2). I'm using Message Id as Message, do I need to set the advanced parameter? In my flow I used Create File, which worked but I would need to add a way to save the attachment with a new name.

     

    I apologize if my questions are pretty basic but this is really my first attempt at creating a Power Automate flow and I REALLY appreciate your help

    Sam

  • sammary Profile Picture
    158 on at

    Sorry, here are the screenshots

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @sammary 

     

    Not sure why you are not seeing filter array body dynamic content, I think there is some issue due to modern design, just move to classic design and see whether you are able to see body dynamic content of filter array by toggling the below option like below

    Nived_Nambiar_0-1716485911269.png

     

    Also i have forget to add one thing in the flow, using create file after export email scenario. Try to add that as well as shown below

    Nived_Nambiar_1-1716485996136.png

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

  • sammary Profile Picture
    158 on at

    Nived,

    You have been amazingly helpful, thank you VERY much.

    Some other person helped me to get the emails with attachments and that works perfectly. So, all I need to do is get the emails without attachments to download. For these files I will have to write a Python program to extract a hyperlink that opens a PDF and then saves that PDF.

     

    For some reason I assumed that the false condition meant that there was no attachment. I see that I was incorrect and will apply the flow that I have that I know works for the attachments. As for your flow I'm still having issues. The flow works however the file is empty. Also, the .eml creates an email file so I changed it to a .txt to see if that would make any difference, it didn't. Again, I need to make sure that the hyperlink remains in the file, that's the only part of the file that I really need. There are other parts but with some work I can get that information out of the PDF.

    sammary_0-1716493378987.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard