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

Announcements

News and Announcements icon
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 253

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:
  • trice602 Profile Picture
    16,699 Super User 2026 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
    253 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,501 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
    253 on at

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

  • apettit Profile Picture
    253 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,501 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
    253 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 315 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 267

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard