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 / Email attachments from...
Power Automate
Unanswered

Email attachments from SharePoint Document Library to Outlook not attaching readable files or not attaching at all

(0) ShareShare
ReportReport
Posted on by 77

Hello, long-distance new friends.

Forgive me for asking for your help. I have scoured this channel and Google at large, and after 72 long lost hours, I admit defeat. I don't know what I'm doing. I sheepishly ask for your help because I know there are SEVERAL posts somewhat similar to what I'm about to ask, but I raise my right hand and solemnly swear that I have tried every which way, so I am praying you won't snub me and point to another post. :s Sowwwwwyyyyy.....

Ok. So here's the nitty gritty.
The goal: Use a form to create and update a Word doc based on a template, save/upload that Word doc to a SharePoint library, then send an e-mail and attach that newly created file to the e-mail.
Current state: The flow takes the form responses, updates the Word doc template, and uploads that Word doc to the SharePoint library it's supposed to (success!!). (The file is open-able and is correctly filled in with information.) The flow also currently sends an e-mail to the e-mail I want it to. It does NOT attach a readable file.

Random facts:

  • When I run tests, I can see that the flow understands there IS an attachment, but it seems to be in a format that is not readable.
  • In other tests when I've used other actions (like Get file content using path), the e-mail will come in with an attachment, but then the attachment is unreadable. With the screenshots I'm showing below, I have resorted back to the simplest version of this flow. This simple version sends an e-mail, but there is no attachment. (So it's essentially one step back from the closest point I've actually achieved in my larger goal.)
  • Whatever solution is achieved, I would like to understand HOW IT WORKS. Since I'm building this for my team and might be the only one who knows this tool, I need to be able to modify this flow and truly understand what's going on. I do NOT have a coding background, so this is kind of unfortunate because it means the solution has to be suuuuuuuper simple and dumbed down for me to really "get" it. 😞
  • I really, really do not have a coding background, you guys. Please be gentle with me and not afraid to dumb things down for me! I learned that Power Automate exists about 2 weeks ago, and I've learned a lot, but I legit know basically nothing about coding. I've been learning via communities like this and YouTube to Frankenstein flows together.
  • I'll list various things I've tried at the end, after the screenshots. I'd like to avoid "apply to each" and "appending variables" IF I can/IF it's possible. It complicates the flow for me and my baby-coding brain gets all turned around. Simple and clean is incredibly critical here. You can ignore or read the things I've tried. Maybe it will give more ideas for what will and won't work?

 

Screenshot time.

 

Birdseye view of the whole flow:

2024-02-29-- Flow-birdseye.PNG

Compose inputs:

2024-02-29-- Flow-Compose input expressions and dynamic variables.PNG

After testing, looking at results of compose inputs:

2024-02-29-- Flow-compose input.PNG

After testing, looking at results of compose outputs (it's the same as the results from the inputs from what I can tell):

2024-02-29-- Flow-compose output.PNG

After testing, looking at results of the whooooole compose input/output string (so you can see what the end of the string looks like... it's more than 37 pgs of string gobbledygook. I've cut that out and replaced with an ellipsis [...]). Note that the file name is correct; $content seems to be where it's going awry?:

2024-02-29-- Flow-compose input and output til the end.PNG

The send e-mail bit of the flow, expanded:

2024-02-29-- Flow-email attachment section.PNG

What I'm putting in the Attachments section of the e-mail via an array (ignore that it's not in the box yet-- I couldn't get it to show the expression without creating it fresh again.):

2024-02-29-- Flow-email attachment expression.PNG

After testing, results of the e-mail header output (I don't know what these link thingies are, so blocking just in case....):

2024-02-29-- Flow-email header output-1.PNG

 

What I've tried:

 

 

Categories:
I have the same question (0)
  • Verified answer
    creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @Nunya1 I've noticed that Power Automate can be a bit buggy when using the New Designer with the MS Form trigger. Can you try editing your flow in the Classic Designer. 

     

    Also, can you move your Get File content action AFTER you've created the file. Currently you are getting the content before you've created the file. 

    creativeopinion_0-1709239433584.png

     

    You find these YT Tutorial helpful:

     

    How to Get a Microsoft Form RSVP Response into a SharePoint List

    I cover the following in this video tutorial:

    How to get a Microsoft Form Response into SharePoint

    How to get a Microsoft Form ID

    How to get a Microsoft Form response

    How to Build a Microsoft Form with Conditional Fields

    How to used Branching in Microsoft Forms

    How to format Microsoft Form multiple choice responses for a SharePoint multi-choice column

    How to parse a Microsoft Form multiple choice response as string of text

    How to convert a text response to a number

    How to use the Switch action

    How to create a custom email confirmation for a Microsoft Form submission

    How to Create a Custom View in a SharePoint list

    How to use the Compose Action

    How to write Power Automate Expressions

     

    --

     3 Mistakes YOU 🫵 are Making with the Apply to Each Action in your Microsoft Power Automate Flow

     

    In this video tutorial I’ll go over how to avoid these common mistakes when using the Apply to Each action in a Power Automate flow:

     

    1️⃣ Looping through a Single Item

    2️⃣ Creating Unnecessary Nested Loops

    3️⃣ Looping through an Unfiltered Array

     

    At the end of the video I share a few helpful insights when it comes to using the Apply to Each action in your flow.

    I'll also cover:

     How to avoid the Apply to Each action with a single item array

     How to use the item() function to access dynamic content in an array

     How to prevent unnecessary nested Apply to Each action loops

     How to use the Select action

     How to convert an array to a string with the Select action

    How to use the Filter Query field

     How to count the number of items in an array

     How to use a condition control

     How to use the concurrency control

     How to set a top count

     How to use Compose actions for troubleshooting

     

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response! If you're feeling generous— ️  Buy me a coffee: https://www.buymeacoffee.com/acreativeopinion

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok
     

  • Verified answer
    Nunya1 Profile Picture
    77 on at

    You guys. My final perusing through the Internet has confirmed that at the moment you give up, that's when you somehow find an answer. Maybe. I have attempted one last test, and it appears to be doing something correctly. I am getting an e-mail, and I can open the file. The file does not have the correct content, so my guess is that I'm pulling from the wrong dynamic details. I'm in the middle of updating my Flow, but I was so excited, I thought I'd come share in case some other poor soul is struggling and limping along like I was. I will update this post with an amendment if my final tweaking yields the desired results.

    *Most of the kudos currently goes to @Paulie78  who posted in this post... https://powerusers.microsoft.com/t5/Building-Flows/files-corrupted-when-sending-multiple-attachment-in-emails-from/td-p/728295 and whose fixes I've Frankensteined together and guessed and scrapped to get as close as I am now. (See his blog post)

    Update: Additional kudos for @creativeopinion for suggesting that I add another "get file content" later after the file is actually created. (Note: I need the first "get file content" because it's actually calling for the template that's stored in SharePoint's library. [Shout-out to @DamoBird365 in this vid.] That's what the Flow will use to fill it in with the users' answers from the Form. I now have a second "get file" [but get file content using path] so I can get the newly created file-- great catch, @creativeopinion ! Thank you!)

     

    I tried Paul's solution since it was the only solution I saw that seemed to tweak the "$content" bit that appeared to be the part that Outlook couldn't parse.

     

    I am using his initialize variable (setting that to an array) and then Frankensteining his code that he used to append the variable (I tried setting the variable, and apparently that's not allowed and incorrect. System rejected.). Here's my Flow so far and what is now giving me a readable file!!

     

    Birdseye view of Flow being updated (note, I am adding an action to Get file content using path, which I think will allow me to get the newly created file. Also ignore the compose action, "Attachment2", which I kept for safekeeping, but will now be ok to delete if my tweaking works...):

    2024-02-29-- UpdatingFlow-birdseye.PNG

    2024-02-29-- UpdatingFlow-birdseye 2.PNG

    Initializing the variable, which Paul said to set as an array:

    2024-02-29-- UpdatingFlow-InitializingVariableArray.PNG

    The Append to Array action, expanded. I copied Paul's code that he put on his blog (see the link) and just put this directly into the box, not into the expression. (This part always confused me when trying to mimic solutions.) When I double-click on the little icons that look like dynamic content, it gets you into the expression details, and shows you the code. I got into those expressions to change any instances of "Get_attachment_content" to "get_file_content" since that's where I'm getting mine. I will now go in and change that to whatever it needs to be to match the "get_file_content_using_path"... I hope I can figure it out! I changed the Name so that it matches what the file name will be dynamically. [Right now, it's a dynamic title generated from the user's answer in the Form.]):

    2024-02-29-- UpdatingFlow-UpdatingArrayVariable.PNG

    The send e-mail action, expanded. In the Attachments section, I switched to the array (that little icon to the left of the "x"), then just hit the dynamic content button and added the variable, which is an array:

    2024-02-29-- UpdatingFlow-AddingDynamicVariableAsAtt.PNG

     

     

    UPDATEEEEE
    Guys, it works. After several workdays lost, it finally works. I'm not crying, you're crying.

    Final birdseye view of the Flow, final tweaks made as I wrote before. My goodness gracious. Thank you, Lord.
    2024-02-29-- FlowFinalized-birdseye.PNG

    2024-02-29-- FlowFinalized-birdseye2.PNG

  • Nunya1 Profile Picture
    77 on at

    Yes, brilliant, @creativeopinion ! You have hit on what I just discovered as well-- I need a second get file content of some sort after the file is created. Thank you! Definitely going to keep track of this response for these helpful resources. As of right now, I think I'm on the right track with another solution (see my post a couple seconds ago), but that bit of advice you just offered is going to be key too. Pray for me! 😳

    Thank you so much for taking the time to respond and consider the goal + issue. I really do appreciate it. I know it takes time to reply.

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard