cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mwitcomb
Frequent Visitor

Office documents in email attachments are all corrupted

I've looked into so many threads and tried almost everything but all my attachments that I send via Outlook are corrupted when I try to open.

 

These files sit (added via Planner Tasks) under the Shared Documents folder on my Sharepoint site

 

mwitcomb_0-1651337111844.png

When a user completes a task they add an attachment.

When the Complete status is chosen it triggers the Flow.

Here is my complete flow

mwitcomb_1-1651337217690.png

 

I start by getting the Task ID that has been triggered

mwitcomb_2-1651337249480.png

 

Initialise a variable to add the various attachments too (there will be more then 1)

mwitcomb_3-1651337283922.png

 

Using the references object from the previous task I go and start finding the file(s) in question

mwitcomb_4-1651337320559.png

 

First by using Get_file_content_using_path then using Get_file_metadata_using_path

mwitcomb_6-1651337557924.png

Whack those into the variable

mwitcomb_7-1651337593043.png

Then add the variable to the Attachments field in outlook v2

mwitcomb_8-1651337636519.png

The flow completes and email is sent no problems.

When I open the attachments from the email they are all corrupt.   Why???

 

I've checked the outputs from the completed flow and the content & contentBytes matches up

mwitcomb_9-1651337765822.png

 

I have also tried to base64 code the contentBytes in the array (not shown) but this just shows a different contentBytes and also corrupts the file

mwitcomb_10-1651337827039.png

 

Any idea what I'm doing wrong??

 

1 ACCEPTED SOLUTION

Accepted Solutions
mwitcomb
Frequent Visitor

1 REPLY 1
mwitcomb
Frequent Visitor

I figured it out - missing content-type

Thanks to @Paulie78 for the post they put up - https://powerusers.microsoft.com/t5/Building-Flows/files-corrupted-when-sending-multiple-attachment-...

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (2,813)