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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,977)