Hi, I have flows set up to save attachments from emails to a onedrive for business folder - This works OK.
I then have a flow set up to check the count of files in the folder and if 2 or more, attach those files to an email, send and then delete the source files. This flow runs without error however the file content being sent/received is incorrect.
The input data is .txt or .csv files and contains data like:
however the data being received over email (With the right filenames) has data like:
My flow is set up to trigger when a file is saved, list files in folder, for each file increase the value of a Integer variable, then i initialise an array variable, then do a check on the integer variable and if greater than or equal to 2 it proceeds to this step:
Then the email that is sent has the allattach variable listed in the attachements section:
Ive tried searching a number of other posts/questions/guides however everything i can find is using Sharepoint instead of onedrive and the actions are subtlety different.
Any help is appreciated,
Thanks,
Khris
Thanks DamoBird365 - Absolutely right in that i need to use the File Content, i was following guides for Sharepoint and they say about using the array and the name + Body but its so obvious now we have mentioned it.
It works now using the file content but i will digest what you have said and hopefully give that a try to see the outcome if it would be a more efficient solution.
Thanks again,
Thanks Eric-Cheng - Im not entirely sure why i had it set up as body, I was following a how to guide but as you have written, its quite obvious now to think it should be the File Content from their. Probably due to the guides i was looking at referencing SharePoint and adding it in this way (Name and then Body).
I have changed this and it ran successfully first time, thank you for highlighting that so quickly!
You need to check the dynamic value that you have used for file content. It is returning a JSON array of the body - you specifically want file content from the get file content action.
Here is an alternative solution for you to explore too:
Expressions are highlighted in comments. You can use length() to get the length or number of objects (i.e. files) returned in an array. Then get the file content in an apply to each and create a compose for each attachment.
Outside of the Apply to each, call the compose actions into an array using outputs() and place that into your email.
You will not need to use variables and hopefully have a more efficient solution.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉
Hi @KhrisJones ,
In your append to array action, can you please check you are referencing the correct value for ContentBytes? I believe it should be File Content from Get File Content 2.
--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up
Connect on LinkedIn