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 / Analyzing the first at...
Power Automate
Answered

Analyzing the first attachment of an incoming email, only.

(1) ShareShare
ReportReport
Posted on by 245

I have the flow below and I only want to search the first attachment.  I've tried a couple of different ways but am not successful.  When I get attachments, it's turning it into Apply to all and it's not easy to get out of that.  Please advise!

 

Flow for Sub Plans.png

Categories:
I have the same question (0)
  • trice602 Profile Picture
    15,886 Super User 2025 Season 2 on at

    Hi @apettit ,

     

    I think you can add an additional conditional check like this:

     

    equals(outputs('Apply_to_each')?['body/index'], 0)

     

    Here it will be true only for the first attachment.

     

     

  • apettit Profile Picture
    245 on at

    So, ultimately, I want to use a conditional check in the Yes condition of the first condition, that checks if the first attachment is 'application/pdf'... should I use what you shared there?

  • Verified answer
    Sundeep_Malik Profile Picture
    6,484 on at

    Hey @apettit 

     

    To avoid apply to each action.

    You can use the following technique: 

     

    Write the following expression in attachment id:

     

    triggerOutputs()?['body/attachments']?[0]?['id']
     

    Sundeep_Malik_0-1695152507889.png

     

     

     

     

     

    I hope this helps 🙂

  • apettit Profile Picture
    245 on at

    You the man!  It worked!  Thank you so much!

  • apettit Profile Picture
    245 on at

    Hi!

     

    My test runs work, but a user sent in a link and my get attachments broke... Will you please consider this?  Thank you!

    2023-09-20 06_29_16-Sub Plans - Inbox - Sub Plans - Outlook.png2023-09-20 06_27_56-Run History _ Power Automate.png

  • Verified answer
    Sundeep_Malik Profile Picture
    6,484 on at

    @apettit 

    Oh seeing this error for the first time.

    So your colleague didn't send any attachment and sent a link to the file.

    Is that the case?

     

    So what I will suggest is before this action add a condition which checks if the email has attachments or not.

    If it has, then add everything on left side. If it doesn't you should find a way to extract that file.

  • apettit Profile Picture
    245 on at

    I think you've got it.. you're right, I shouldn't Get attachments or anything until I figure out if there was one anyway.... so I moved the Get Attachment and the Condition to read the attachment for PDF content for a Yes to the email having an attachment condition.  Thank you, again! 🙂

    2023-09-20 07_37_32-Edit your flow _ Power Automate.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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 398 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 323 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 183 Most Valuable Professional

Last 30 days Overall leaderboard