Showing results for 
Search instead for 
Did you mean: 
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. 🙂


Thank you in advance!

Helper I
Helper I

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:




Let me know if this helps.




Helpful resources

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (3,732)