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.
Thanks in advance, it is driving me crazy.
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.
Hi!
I had the same issue and your post helped me to fix it!
thank you 🙂
Thanks @ekarim2020. I've done that along with adding my list tracker and it all seems like it's working great. Thanks again 🙂
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):
Select the Menu option (1):
Select Settings:
Click add, then add the trigger condition:
The flow should only trigger if the item that was just created is NOT a folder. Enter the expression as shown below:
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
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!
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:
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
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:
Any thoughts as to why that may happen?
Many thanks 🙂
Hi @CeriRobbo ,
Here is a flow that might work for you:
We want only email files when a file is created so we need to ignore if a folder was created in the document library:
Next get the file content and email the file to the recipient:
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
WarrenBelz
146,776
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,093
Most Valuable Professional