cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vsolanon
Helper III
Helper III

Flow to select and send onedrive file as an attachment in email

Hello Experts!

 

Is it possible to get a specific file saved in OneDrive and send it as an attachment via email (based on an item from SP list)?

 

I have a first flow that creates a PDF letter and saves it in my OneDrive and I would like to create a second flow that runs and send an email to a specific person included in the SharePoint list with the PDF letter as an attachment.

 

I have a choice column in my SP List with the values "Sent", "Pending" and "To be sent". Once the column is marked as "To be sent" my second flow will run. The trigger is "When an item is created or modified". Now I am trying to find a way where I can select a specific letter from my OneDrive based on the item selected in the trigger and attach it in the email. 

I tried by saving the  "Id" generated when I created the PDF file from the first flow in the "Title" column from the SharePoint list in order to use this code in my second flow to know which letter to select, but it did not work.

 

I am using this approach because I noticed that after I saved a PDF in my SharePoint list "attachment", I got an error when opening (see image below). 

 

I really appreciate any guidance on how to create a rule to identify which PDF file to be selected from the OneDrive and attach it in the email. I was thinking of creating a rule that looks for a specific file name in the OneDrive but has not been able to achieve it. 🙂

Flow.JPG

Thank you in advance!

1 REPLY 1
J_Porter
Helper I
Helper I

Here,
Try this:

Make sure to set "Limit Columns by View" to "Use all columns (Do not limit)" in the When an item is created trigger.

What I've done is selected a file in the SharePoint site location that stores the attachment and then replaced the two values defining row / 'ID' (from trigger) and 'Display Name' (from get attachments) this will look for the attachments dynamically as they are added to the list.
This will give an error if you add an item with no attachment, so I suggest adding a control action to only process the get file content using path action if the 'has attachments' value is equal to the Boolean true.

As shown below:

J_Porter_4-1613110732625.png

J_Porter_5-1613110802431.png

 

Let me know if this helps.

 

 

 



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!

Top Solution Authors
Users online (3,838)