web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Files will not attach correctly to the Sent Email.

(0) ShareShare
ReportReport
Posted on by 235

Hello, please help,

 

Here is the gist of it; we have a SP list of employees, and a secondary list which contains the (numerous) files for each employee. In other words, there is an employee roster, then there is a sort of 'File Cabinet'.

The end goal of the flow: To input an employee's name and return an email with all files attached under that name.
Progress: I have written the flow, it is manually triggered, requiring you to input the employee's name and their manager's name. It takes this information, and after some variable initialization, compose-select, and compose-item creation, we Set Variables so that we can use them in the Get Items() action.
This is great, it finds the employee files, confirms it by returning the appropriate item count, then uses Get Items(ID) to Get Attachments(). Then For Each(Get Attachment Content). 
The Problem: This is where we run into the problem. I was not sure how to compile the attachments, so I googled for help, and got this answer. ForEach(Get Attachment Content) -> Append to Variable Array.
Great, this makes sense. Problem is, I think there may be some issue with the code, because when I use the output in the email Attachment Content it feeds back a null file (not able to be opened properly); and when it is opened, it's just pages upon pages of code. It seems like it is not able to properly grab the file types or separate them out. Could I get some help or maybe an explanation on how to fix this?

Tmalonson_1-1692720365751.png

Here is the code inside of the Append

 

{
 "name": "@{items('Apply_to_each')?['DisplayName']}",
 "contentBytes": {
 "$content-type": "@{body('Get_attachment_content')?['$content-type']}",
 "$content": "@{body('Get_attachment_content')?['$content']}"
 }
}

 

 

Tmalonson_0-1692720304794.png

 

I have the same question (0)
  • Verified answer
    Tmalonson Profile Picture
    235 on at
    Re: Files will not attach correctly to the Sent Email.

    Solution found,
    The issue was within the Send Email (V2)
    The outputs(compose) has to be inserted into the manual code as opposed to the 2 File name/ Attachments format.

    Tmalonson_1-1692731988835.png

     

    Tmalonson_0-1692731941257.png

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 722 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 461 Moderator

#3
developerAJ Profile Picture

developerAJ 283

Last 30 days Overall leaderboard