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 / Saving attachments and...
Power Automate
Answered

Saving attachments and iterating through them to match emails

(0) ShareShare
ReportReport
Posted on by 11
Hi,
 
So I'm struggling with this issue, I am using the Retrieve email messages from Outlook action for All emails with Subject "ApprovalsTest" and save the attachments into a certain folder. So say there are 3 emails with attachments, they all get saved into the folder just from that one action, but now I have no way of iterating through my emails and moving them to an In Progress folder because I can't match the file saved to the email it came from. This is a snippet of a code and I hope it makes sense of what I am trying to do

 
How can I extract and save attachments one by one or rework my code to make this method work please. Any help would be greatly appreciated, thank you :)
I have the same question (0)
  • Suggested answer
    Riyaz_riz11 Profile Picture
    4,048 Super User 2026 Season 1 on at
    Hi,
     
    • Retrieve Emails

      • Action: Retrieve email messages from Outlook

        • Filter: Subject = "ApprovalsTest"

        • Retrieve: Only unread or all (your choice)

        • Store output in variable: %RetrievedEmails%


    • For Each Email

      • Action: For Each

      • Value to iterate: %RetrievedEmails%

      • Current Item: %CurrentEmail 

    • If Attachments Exist

      • Action: If

        • Condition: CurrentEmail.Attachments.Count > 0

    • For Each Attachment

      • Action: For Each

        • Value to iterate: %CurrentEmail.Attachments%

        • Current Item: %CurrentAttachment%

    • Save Attachment to Folder

      • Action: Save email attachment

        • Attachment: %CurrentAttachment%

        • Destination folder: "C:\YourFolder\" (adjust as needed)

    • Move Email to In Progress

      • Action: Move email message

        • Email: %CurrentEmail%

        • Destination folder: "In Progress"

          If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
          Regards,
          Riyaz

  • TM-18062219-0 Profile Picture
    11 on at
    Thank you for the response, I presume thats the AI response from ChatGPT or CoPilot as sadly there is no Save Email Attachment action
  • Verified answer
    TM-18062219-0 Profile Picture
    11 on at
    So I figured out the way to do this! So I did as before with Retrieve email messages from Outlook and saving all the attachments to the folder, but then to match each file in the folder, I matched it against the CurrentEmail.Attachment, the screenshot below will make more sense, so now it only pulls the file that is in the CurrentEmail

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard