Hey all!
I'm having a little trouble. I have a flow set up with two conditions to download and save attachments from a shared mailbox to a sharepoint folder.
Everything appears to be working...the correct email is pulled...the file is created and saved in the appropriate folder with the correct name. But it's empty...
Some of the attachments are PDFs, and some are CSV files. The CSV file that gets saved by the flow has a single cell with "null" in it. The PDF files do not open. Note that it is not an issue with the attachments themselves--they open fine and have data in them--when downloaded manually.
Any help would be appreciated!
Thanks.
Solved! Go to Solution.
Hello @stephenkln ,
I think the simplest solution in such cases is to store the dynamic content into a 'Compose' action and then use the output from the 'Compose' in the expression.
@Anonymous I found a solution that worked for me here: https://powerusers.microsoft.com/t5/I-Found-A-Bug/Email-as-an-attachement-contentBytes-is-null-bug/td-p/53524
Under the advanced settings of the initial trigger..."When a new email arrives..." change the following settings to "Yes"
- Only with Attachments
- Include Attachments
Note you might have to recreate your flow to get this to work. Simply toggling them to "Yes" did not fix it for me. I had to rebuild the flow from scratch with them toggled "Yes", then my attachments started saving with all the content.
Hello @stephenkln ,
try to convert the 'Attachments Content' to binary using the base64ToBinary(...) expression. The attachments from an email seem to have a different encoding than expected by SharePoint.
base64ToBinary([Attachments Content])
@tom_riha thanks for the suggestion! I cannot get that to work. [Attachments Content] is not a dynamic content option for the expression. Any other ideas or am I not doing it right?
Hello @stephenkln ,
I think the simplest solution in such cases is to store the dynamic content into a 'Compose' action and then use the output from the 'Compose' in the expression.
I am having a simmilar problem and I tried to use your solution. but It dident help me.
When I try your solution the flow fails and says the base64ToBinary was expecting a string but got a NULL.
I am trying to save attached files from a e-mail sent to a shared email account in a sharepoint folder.
In the Function "Vedhæftede filer" is: triggerOutputs()?['body/attachments']
In Filnavn is used: items('Anvend_på_hver')?['name']
In Filindhold is used: items('Anvend_på_hver')?['contentBytes']
The flow runs fine and the files is saved to sharepoint. but the files saved is just max 4 byte large.
even if the originally PDF file is 190 bytes and You cant open the file.
Hello @Anonymous ,
the error message tells you that the dynamic content you used in the base64ToBinary(...) is empty, I'd review what is used as the parameter and if it contains any value (store it into a Compose action before the base64ToBinary(...) expression and check if it's not empty).
@Anonymous I found a solution that worked for me here: https://powerusers.microsoft.com/t5/I-Found-A-Bug/Email-as-an-attachement-contentBytes-is-null-bug/td-p/53524
Under the advanced settings of the initial trigger..."When a new email arrives..." change the following settings to "Yes"
- Only with Attachments
- Include Attachments
Note you might have to recreate your flow to get this to work. Simply toggling them to "Yes" did not fix it for me. I had to rebuild the flow from scratch with them toggled "Yes", then my attachments started saving with all the content.
This worked for me. Thanks!
User | Count |
---|---|
92 | |
45 | |
21 | |
18 | |
16 |
User | Count |
---|---|
136 | |
49 | |
42 | |
36 | |
28 |