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 / send attachments from ...
Power Automate
Suggested Answer

send attachments from library

(0) ShareShare
ReportReport
Posted on by
Hi everyone,
 
I try to get all files from sharepoint (currently 2 files in the library), and send them within multiple attachments.
 
Here is my process:
 
get files properties
get file content with identifier from get files properties (so in a for each)
add a compose just after the get file content with the following:
{
  "Name": "@{items('For_each')?['{FilenameWithExtension}']}",
  "ContentBytes": "@{body('Get_file_content')}"
}
 
after the loop, add another compose to store the previous one
send email (v2)
 
after running the flow, everything seems ok, but the files within the email are not readable.
I also tried with:  "ContentBytes": "@{body('Get_file_content')?['$content'}" but i still receive the same issue.
 
If anyone get the same issue and solved it, it's welcome.
 
Thanks to all.
Categories:
I have the same question (0)
  • Suggested answer
    Vish WR Profile Picture
    2,101 on at
     
    Hi Good Day 
    The main problem is that a Compose action is a temporary placeholder. Every time your loop runs for a new file, it overwrites the previous data in that Compose action. Even if you have a second Compose outside the loop, it only "sees" the very last file processed.
     
    To fix this, you need to change your logic from "replacing" data to "collecting" it.
     
    The Approach
    Declare the Variable First: Before the loop starts, use the Initialize variable action. Set the type to Array. Think of this as an empty bucket that stays open throughout the entire process.
     
    Append Inside the Loop: Instead of using Compose, use the Append to array variable action inside your loop. This ensures each file is added to your "bucket" one by one without deleting the files that came before.
     
    Process After the Loop: Once the loop finishes, go to your Send email (V2) action.
     
    Look for the Attachments section.
     
    Click the "Switch to input entire array" icon (the small "T" icon on the right).
     
    Insert your Variable into that field.
     
    By declaring the variable first and appending to it, you ensure every file is saved and passed to the email in a format that remains readable.
     
     
     
      Vishnu WR
     
    Please âœ… Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like â™¥
     
     
     

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
Valantis Profile Picture

Valantis 711

#2
Vish WR Profile Picture

Vish WR 691

#3
Haque Profile Picture

Haque 525

Last 30 days Overall leaderboard