I have built a Flow that automatically uploads Excel email attachements to a SharePoint library. The Flow runs successfully, and appears to be okay, however I am unable to open the files from SharePoint (both web version and desktop version). Does anyone have any idea? Screenshots below. Thanks!
Flow:
SharePoint (looks okay):
Web Error Message:
Desktop Error Message:
Solved! Go to Solution.
Hi @SamB2 ,
You can try the following:
You can copy-and-paste the following into the compose action:
{
"$content-type": @{items('Apply_to_each')?['contentType']},
"$content": @{items('Apply_to_each')?['contentBytes']}
}
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
Hi @SamB2 ,
Please see: How to save PDF email attachments to OneDrive for Business using Power Automate – Ellis Karim's Blog which you can easily change to handle Excel files:
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
Hi @EK - thanks for your response however this looks to be exactly the same as my Flow already (see my first screenshot above). Just for completeness I have tried changing Attachment Name ends with (instead of contains). The Flow appears to work okay and looks good in SharePoint, it is just when I open up the file I then get the error message.
Hi @SamB2 ,
Can you check that you can open the file attachments within Outlook? We want to make sure that the file is valid and isn't corrupt.
What file size is reported in SharePoint after the file has been saved?
Try deleting the create file action, then re-add the create file action.
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
Yes I can open the attachments okay in Outlook, and can also manually upload the files to SharePoint which also open okay, it is just when the Flow runs I get the error. There are some files that do work but there are also some that don't and I can't see anything different with these.
(1) What is the file size that is reported for the files that you can't open.
(2) Can you preview the file within the browser. Don't open the file using the Excel desktop app but preview within the browser:
Ellis
1. An example of one that doesn't open has a file size of 23.7KB, whereas I have ones that do work with file sizes of 26.3KB.
2. I am unable to preview the affacted files in trhe browser (I get the same error message as my 3rd screenshot in original post).
I can't see an issue with the flow itself.
1. Try deleting the create file action, then re-add the create file action. Test
2. Try deleting the trigger action, then re-add the trigger action. Test.
3. Or save a new copy of the flow or Create a new flow. Test. Remember to turn off the old flow.
Occasionally flows or actions are known to get corrupted. It's more time efficient to delete and the re-add actions than trying to debug flows.
Ellis
I have just tried recreating the Flow from scratch and am still getting the error on some files. I have also asked a colleague to try and they are getting the same too.
Hi @SamB2 ,
You can try the following:
You can copy-and-paste the following into the compose action:
{
"$content-type": @{items('Apply_to_each')?['contentType']},
"$content": @{items('Apply_to_each')?['contentBytes']}
}
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
@ekarim2020 thanks for this - using that compose action appears to be working! Further down in the Flow, it uploads the file to another location which I left as the orginal Attachment Content (dynamic content) and that one still wasn't working, whereas it uploaded in the first location fine. I note you said for testing purposes only, can this not be used as a permanent solution?
Hi @SamB2 ,
Yes, the solution can be used permanently. In the compose action we are manually specifying the "File Content" properties, whereas in the Create File action, the properties are set using the dynamic Attachments Content. Both the compose action and the dynamic Attachments Content should be exactly the same.
I suspect that the "$content-type" property may be missing during the Create File action and this is what may be causing your problem. This seems to be a bug. The issues occurs sometimes but we don't know what the root cause of the problem is.
When I remove the "$content-type" property from the compose action I get the same error:
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
User | Count |
---|---|
88 | |
39 | |
23 | |
20 | |
16 |
User | Count |
---|---|
128 | |
50 | |
48 | |
35 | |
26 |