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 / Flow condition dependi...
Power Automate
Answered

Flow condition depending on multiple email attachment types

(0) ShareShare
ReportReport
Posted on by 32

Hi all,

 

I've made a flow that starts from "when a new email arrives", and wondering if a solution exists for the below idea.

 

If there is no attachment, do "AAA", else check attachment name,

Then if attachment name contains .xls or contains .xlsx, do "BBB", else do "CCC".

 

The problem #1 is that the pictures inserted in email bodies are considered as attachments in the flow.

The problem #2 is that the check on attachment names is made for every single attachment.

For instance if an email arrives with an Excel file AND some pictures in the email body, I would like the flow to do "BBB" only.

But right now the flow does "BBB" and "CCC" depending each single attachment.

 

Any idea to make that happen please?

 

Categories:
I have the same question (0)
  • v-dezhili-msft Profile Picture
    Microsoft Employee on at

    Hi @Bubulover ,

    Do you want to only execute 'BBB' operation when there is' xlsx 'or' xls' file in the attachment?
    You can create a string to store the suffix of all attachments and then determine whether the string contains' xlsx 'or' xls' to decide which operation to perform.

    split(items('Apply_to_each')?['name'],'.')[1]
    or(contains(variables('A'),'xlsx'),contains(variables('A'),'xls'))
    vdezhilimsft_0-1666759208495.png
    vdezhilimsft_1-1666759208497.png
    vdezhilimsft_2-1666759208500.png
    vdezhilimsft_3-1666759208501.png
    Best Regards,
    Dezhi
  • Bubulover Profile Picture
    32 on at

    Dear @v-dezhili-msft ,

     

    Thanks for taking a look to my request.

     

    I think that I've sucessfully duplicated your logic but unfortunately it doesn't fit exactly what I need.

     

    The issue remains on scenarios with emails sent with multiple attachments.

    When there is only one attachment, or when there is no attachment, the flow works as expected.

     

    Multiple attachment example #1:

    If an email is sent with two .xlsx files, I would need to execute the outcome "BBB" twice, one per file.

     

    Multiple attachment example #2:

    If an email is sent with one .xlsx and one .docx, I would need to execute the outcome "BBB" once (for the .xlsx file) and that's it, no outcome "CCC" at all.

     

    Do you think there is a way ?

     

    Thank you !

  • Verified answer
    v-dezhili-msft Profile Picture
    Microsoft Employee on at

    Hi @Bubulover ,

    Do you want to execute 'BBB' as many times as there are Excel files?
    You can use the Switch action to save the file information with the suffix 'xlsx' or 'xls' into an array, and then determine the length of the array. If the length is greater than 0, the array will be cycled to execute' BBB '. Similarly, you can handle image attachments in the same way to execute' CCC '

    vdezhilimsft_0-1666839723356.png

     

    vdezhilimsft_1-1666839723357.png

     

    vdezhilimsft_2-1666839723358.png

    Best Regards,

    Dezhi

  • Bubulover Profile Picture
    32 on at

    Hi @v-dezhili-msft ,

     

    Again, a big thank you.

     

    My testing flow is working as expected now!

    I did testing with multiple scenarios.

     

    I've just moved the Condition #2 within the Switch part of the flow.

     

    Hereunder are printscreens of this flow, could you please take a look and let me know if you identify anything odd?

    (I've translated to english all text changeable)

    I'm not 100% confident of my own understanding.

     

    Thank you very much!

     

    Bubulover_0-1666864907802.png

    Bubulover_1-1666864964085.png

    Bubulover_2-1666865024131.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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard