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 / 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!
Categories:
I have the same question (1)
  • Sam_Fawzi Profile Picture
    750 Super User 2025 Season 2 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
    750 Super User 2025 Season 2 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

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard