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 / Getting file content f...
Power Automate
Unanswered

Getting file content from Sharepoint and attaching to email

(0) ShareShare
ReportReport
Posted on by 15

Hi

 

I'm new to PowerAutomate and have tried multiple different 'dynamic content' expressions but cannot get this to work. I just want to attach a file from a sharepoint folder to an email, as soon as a new file is created in the folder. I have managed to get file information correctly into a Sharepoint List at the beginning of the flow but having trouble with the email attachment as I can get it to send an email but with a blank attachment that cannot be opened and has no file extension. The 'Attachment Content' field if i just add 'file content' as screenshot below comes up with an error message and automatically adds in 'Body'.  With 'Body' included it just send the blank file with no file extension. 

 

CeriRobbo_0-1677878658944.png

CeriRobbo_1-1677878943519.pngCeriRobbo_2-1677879039606.pngCeriRobbo_3-1677879090344.png

Thanks in advance, it is driving me crazy. 

Categories:
I have the same question (0)
  • Verified answer
    Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    Hi @CeriRobbo ,

     

    Here is a flow that might work for you:

     

    Snag_6661aeb.png

    We want only email files when a file is created so we need to ignore if a folder was created in the document library:

    Snag_666a921.png

     

    Next get the file content and email the file to the recipient:

     

    Snag_6702eb1.png

    Snag_6708721.png

    Hope this helps.

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as ☑️ Solved.
    If you like my response, please give it a Thumbs Up.
    My Blog Site

     

  • CeriRobbo Profile Picture
    15 on at

    Thanks for your suggestion.

     

    I've just tried that and it doesn't seem to like the 'attachment content' just being 'body' and gives the following error: 

    CeriRobbo_1-1677886613195.png

     

    Any thoughts as to why that may happen? 

     

    Many thanks 🙂 

  • Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    Please share your flow including the runtime output of the flow for the Get File Content action. 

     

    This is the runtime from my Demo flow:

     

    Snag_6a5a093.png


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as ☑️ Solved.
    If you like my response, please give it a Thumbs Up.
    My Blog Site

  • CeriRobbo Profile Picture
    15 on at

    CeriRobbo_0-1677915366571.pngCeriRobbo_1-1677915482743.pngCeriRobbo_2-1677915576677.png

     

  • CeriRobbo Profile Picture
    15 on at

    CeriRobbo_3-1677915723393.png

    CeriRobbo_4-1677915813976.pngCeriRobbo_5-1677915855644.png

     

     

  • CeriRobbo Profile Picture
    15 on at

    I have just changed 'Body' in Attachment Content to 'File Content' and it works!!! First time I have received the file expected on email 🙂 

     

    Now I just need to work out how to fit populating some info into my list into the flow so I can keep a tracker of all the files being sent but hopefully will be able to manage this as that was working on my previous flow. 

     

    Many thanks Ellis!  

  • Ellis Karim Profile Picture
    11,681 Super User 2025 Season 2 on at

    Hi @CeriRobbo ,

     

    Now that the flow is working you can use a Trigger Condition to further refine the flow to. We can use a Trigger Condition to run the flow only when a file was created (i.e. do not run the flow if a folder was created):

     

    Snag_90a88c0.png

     

    Select the Menu option (1):

    Snag_23815cc5.png

     

    Select Settings:

    Snag_2381a3e0.png

    Click add, then add the trigger condition:

    Snag_2381f173.png

     

    The flow should only trigger if the item that was just created is NOT a folder. Enter the expression as shown below:

    Snag_90eb412.png

    The expression for the trigger condition is:

    @not(triggerOutputs()?['body/{IsFolder}'])


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as ☑️ Solved.
    If you like my response, please give it a Thumbs Up.
    My Blog Site

     

  • CeriRobbo Profile Picture
    15 on at

    Thanks @ekarim2020. I've done that along with adding my list tracker and it all seems like it's working great. Thanks again 🙂 

  • MRYM290 Profile Picture
    19 on at

    Hi!

    I had the same issue and your post helped me to fix it!

    thank you 🙂

  • Sean_Perry Profile Picture
    11 on at

    After a huge amount of searching I found this response. 
    As below,  once I changed 'Body' in Attachment Content to 'File Content' it worked.
    Surprising that this was so difficult, but thanks for providing a solution to something that has been driving me crazy. 

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