cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Mirian
Level: Powered On

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
Community Support Team
Community Support Team

Re: Copy Sharepoint item attachments as an attachment in the email

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

7 REPLIES 7
Mirian
Level: Powered On

Re: Copy Sharepoint item attachments as an attachment in the email

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?

Community Support Team
Community Support Team

Re: Copy Sharepoint item attachments as an attachment in the email

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

Mirian
Level: Powered On

Re: Copy Sharepoint item attachments as an attachment in the email

Thank you so much!

it is running now.

rovargas
Level: Powered On

Re: Copy Sharepoint item attachments as an attachment in the email

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

Matthew_Gould
Level: Power Up

Re: Copy Sharepoint item attachments as an attachment in the email

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

KelliWard
Level: Powered On

Re: Copy Sharepoint item attachments as an attachment in the email

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

Nathanielyb
Level: Power Up

Re: Copy Sharepoint item attachments as an attachment in the email

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?

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,973)