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

Copy Sharepoint item attachments as an attachment in the email

 
Hello,
I have a flow that starts when an item is created in an online sharepoint list. The flow sends approval emails. I need to include the ITEM attachments as an attachment in the email. The link is not valid for permission issues. Any idea what control to use or how to do it?
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @Mirian,

 

I have made a test on my side and please take a try with the following workaround:

  • Add a "When an item is created" trigger.
  • Add a "Get attachments" action, specify Site Address and List Name. Id field set to ID dynamic content of the trigger.
  • Add a "Variables"-> Initialize variable action, Name set to AttachmentArray, Type set to Array and Value set to empty.
  • Add a "Apply to each" action, Input parameter set to output of "Get attachments" action.
  • Within "Apply to each", add a "Get attachment content" action, specify Site Address and List Name. Id field set to ID dynamic content of the trigger, File Identifier field set to Id dynamic content of "Get attachments" action.

         Add a "Append to array variable" action, Name choose AttachmentArray variable, Value set to following formula:12.JPG

       Within json format text, the key of first element set to Name and corresponding value set to DisplayName dynamic content of "Get attachments" action. The key of second element set to ContentBytes and corresponding value set to following formula:

  • body('Get_attachment_content')?['$content']
    Under the "Apply to each" action, add a "Send approval email" action, Attachments field set to AttachmentArray variable.

Image reference:16.JPG

 

13.JPG

The flow works successfully as below:14.JPG

 

15.JPG

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Highlighted
Frequent Visitor

I have managed to send the attachments each one in an email, but I need them to be all in the same email
the steps :

1. sharepoint-Obtain attachments
2. Sharepoint-Get archive content. Here, an application is automatically created Aply to each and that is where I have sent the file by mailScreenshot_4.png

 Screenshot_5.png

 

 

 

 

How I can send all the attachments in one email?

Highlighted
Community Support
Community Support

Hi @Mirian,

 

I have made a test on my side and please take a try with the following workaround:

  • Add a "When an item is created" trigger.
  • Add a "Get attachments" action, specify Site Address and List Name. Id field set to ID dynamic content of the trigger.
  • Add a "Variables"-> Initialize variable action, Name set to AttachmentArray, Type set to Array and Value set to empty.
  • Add a "Apply to each" action, Input parameter set to output of "Get attachments" action.
  • Within "Apply to each", add a "Get attachment content" action, specify Site Address and List Name. Id field set to ID dynamic content of the trigger, File Identifier field set to Id dynamic content of "Get attachments" action.

         Add a "Append to array variable" action, Name choose AttachmentArray variable, Value set to following formula:12.JPG

       Within json format text, the key of first element set to Name and corresponding value set to DisplayName dynamic content of "Get attachments" action. The key of second element set to ContentBytes and corresponding value set to following formula:

  • body('Get_attachment_content')?['$content']
    Under the "Apply to each" action, add a "Send approval email" action, Attachments field set to AttachmentArray variable.

Image reference:16.JPG

 

13.JPG

The flow works successfully as below:14.JPG

 

15.JPG

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted

Thank you so much!

it is running now.

Highlighted
Frequent Visitor

Hi Milan,

 

Is this solution still working? I cna't seem to replicate it. I get the email from the flow but not files are attached to it. I followed the instruction to a T.

 

Rod

Highlighted

My flow goes through with no errors but there is no attachment in the email, any ideas?

Highlighted

I have been working with this for a couple of days and I can't get past this same error.  

 The template validation failed: 'The action(s) ''Get_Attachment_content' refferenced by 'inputs' in action "Append_to_array_variable_2' are not defined in the template.

(I'd upload a screenshot, but it isn't allowing me to upload it here for some reason.)

 

I think part of the reason is that some changes to Flow tempaltes have been made since this was written, but I can't figure out what to change to correct this error.  It's just outside of my Flows knowledge, so I was just trying to replicate what was created in this SOLUTION.  

 

EDIT:  I FINALLY got it to work.  Dummy me, I needed to add _2 to part of the name.  BUT - Now the issue is that it doesn't attach the uploaded attachment to the initial email. It only attaches to the approved/rejected email.  Reason here is because there is no template for Send Approval Email for Outlook in Flows.  You have to start an approval with a condition attached to it of "if yes" and "if no". I can't get it to work with an approval email like what is shown above.

 

Any chance anyone has some ideas?

 

Thanks!

Kelli

Highlighted

So I feel like I got the entire this correct but in the "append to array variable" I have typed exactly what is in this thread and it says in red below "enter a valid json". any ideas what an amature like me is doing wrong?

 

Highlighted

@v-xida-msft  You don't have an idea of how much you help me thanks a lot !!!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Users online (11,745)