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 / Copy documents from em...
Power Automate
Suggested Answer

Copy documents from email attachments directly to the document library subfolder

(2) ShareShare
ReportReport
Posted on by 603
I have a requirement where emails attachments should be copied to SharePoint document library automatically via Power Automate.
 
I understand at high level that we need to use When an email arrives in Inbox as the trigger and then use copy attachments to copy the documents. May i know how to achieve this?
 
Email subject White Board Logistics Pvt Ltd should be a 3rd level folder and then ABC11345 should be a subfolder and then attachment should be inside ABC11345 folder. 
 
Screenshot give below. 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Haque Profile Picture
    3,229 on at
    Hi @Iantaylor2050,
     
    Let's follow the steps from this blog post.
    You can follow one more here.
     
    What you need is: Parse the Email Subject, to do so let's follow these steps:
    1. Add a "Compose" action to get the email subject. In the Inputs field, select the dynamic content "Subject" from the email trigger.

    2. To extract specific parts of the subject to make or create folder, for example "ABC11345 - White Board Logistics Pvt Ltd.
    add another "Compose" action and use an expression. For example, to get  "White Board Logistics Pvt Ltd" from a subject like
    last(split(outputs('Compose_Subject'),' -')) //-- This will output "White Board Logistics Pvt Ltd" that is your first folder name
    One more compose to take first(split(outputs('Compose_Subject'),' -'))  //==this will output ABC11345, your last folder  name.
     
    NOTE: You may need to adjust the expression based on your exact subject line format and strip off the extra spaces if any.
     
    3. Create the Folder --> Add a "Create new folder" action for your chosen storage (e.g., SharePoint, OneDrive). Select your Site Address or destination. In the Folder Path field, use the dynamic content output from your "Compose" action (which holds your parsed subject/folder name).
    NOTE: Ensure the folder name does not contain invalid characters for your specific storage location.
     
    Finally, when you create file, make sure already created folders are there or use the folder names that you have already extracted using compose and expressions. In the Folder Path, you will be using 3rd level folder name from the extracted Compose method.
     
     
    Please le me know if this helps.
     
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
  • Suggested answer
    Pstork1 Profile Picture
    69,485 Most Valuable Professional on at
    Assuming the subdirectories already exist it will look something like this.  The key is building out the folder path in the compose by deconstructing the subject line of the email.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
     
     
  • Suggested answer
    Kalathiya Profile Picture
    2,163 Super User 2026 Season 1 on at
    Hello @Iantaylor2050
     
    You can do this using Power Automate. 
     
    #1. Trigger: Create a flow with “When a new email arrives (V3)” in Outlook and set Include Attachments = Yes.
    #2. Get Attachment action:
    - Message ID → select Message Id from dynamic content
    - Attachment ID → select Attachment Id from dynamic content (Once you add this, Power Automate will automatically wrap it in Apply to each.)
    #3. Create File in SharePoint:
    - Site → select the SharePoint site where you want to store attachments
    - Folder → select the folder where attachments should go
    - File Name → select Name from dynamic content
    - File Content → select ContentBytes from dynamic content
     
    You can follow the blog below for more detailed steps
     
     
     
    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
    ---------------------------------------------------------------------------------

    📩 Need more help? Just mention @Kalathiya and I’ll be happy to assist.

    ✔️ If this answer helped you, please tick “Does this answer your question?” so it can be marked as the Verified Answer.

    💛 A Like always motivates me to keep contributing!

    ​​​​​​​
     

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 791

#2
Valantis Profile Picture

Valantis 582

#3
Haque Profile Picture

Haque 529

Last 30 days Overall leaderboard