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 / How to pull an attachm...
Power Automate
Unanswered

How to pull an attachment when Attachment is in attached email?

(0) ShareShare
ReportReport
Posted on by 7
Oh boy, did that sentence confuse me.
We have an email that comes in from a vendor and it includes an email which contains an attachment. Because the attachment is an email and the attached email contains the actual PDF we need, I'm not sure how to build a flow to pull that attachment. Does anyone have some advise on how to create a flow to open the attached email, pull the attachment and save the attached PDF to a SharePoint site? Thank you!
email attachment inside email.jpg
Categories:
I have the same question (1)
  • Sam_Fawzi Profile Picture
    879 Super User 2026 Season 1 on at
     
    To create a flow that extracts a PDF from an email attachment (which is itself an email) and saves it to a SharePoint site, follow these steps:
     
    Trigger: When a New Email Arrives
    Use the "When a new email arrives (V3)" trigger from the Outlook connector.
    Filter the emails based on the vendor's email address or subject line to ensure you're processing the correct emails.
     
     
    Get Attachments
    Use the "Get attachments" action to retrieve the attachments from the incoming email.
    Specify the Message ID from the trigger to get the attachments associated with that email.
     
     
    Initialize a Variable to Store the Attachment Content
    Add an "Initialize variable" action to create a variable (e.g., AttachedEmailContent) of type "String."
    Loop Through Attachments
    Use an "Apply to each" action to loop through the attachments.
    • use the "Get attachment content" action to retrieve the content of the attached email.
    • Store this content in the variable created earlier.
    • Use the "Create file" action from the SharePoint connector.
      • Specify the Site Address and Folder Path where you want to save the PDF.
      • For the File Name, you can use the original PDF file name or create a new one based on your requirements.
      • For the File Content, use the content from the PDF attachment retrieved in the previous steps.
     
  • LS-11061622-0 Profile Picture
    7 on at
    @Sam_Fawzi, I apologize if I'm missing something, below is what I currently have set up. When I run the flow with the parameters shown it does not pull the attachment from the attached email, it just pulls the attached email. Where am I going wrong?
  • Sam_Fawzi Profile Picture
    879 Super User 2026 Season 1 on at
     
    before this step, add 
    Get Attachments
    Use the "Get attachments" action to retrieve the attachments from the incoming email.
    Specify the Message ID from the trigger to get the attachments associated with that email.
     
    Next, create an "Apply to each" loop, as the return value from the "Get attachments" action is an array. Inside this loop, you can access the attachment ID for further processing.
  • LS-11061622-0 Profile Picture
    7 on at
    @Sam_Fawzi, below is the flow I have set up for my regular emails with attachments. Are you saying before the Get Attachment (V2) I need to add a step to get the attachment? I'm a little lost on where anything is different.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard