web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Use PowerAutoma...
Power Automate
Unanswered

How to Use PowerAutomate to build a flow to attach specific documents and email to specific people?

(0) ShareShare
ReportReport
Posted on by 31

I'd like to build a process where once a document is dropped to the designated OneDrive folder, it'll automatically be attached to the relevant SP list item by matching the document name with the list item name.  Then an email will be sent to all email address listed in that SP List item.  Is that possible?

 

- size: 200 list items

- email address: 1200 email addresses

 

Here’s the goal:

  1. Create OneDrive Folder to house the documents which is generated on a monthly basis.
  2. Once a file is dropped to the OneDrive folder, PowerAutomate will create the file on SharePoint List items as an attachment.
  3. Once the file is created in SharePoint.  (We can change this flow to move the file.)
  4. PowerAutomate will send an email with the specific attachment to the emails listed on SP List.
  5. Once the file is sent, the attachment in the SharePoint List shall be deleted.
Categories:
I have the same question (0)
  • selfy100 Profile Picture
    228 on at

    This is a good one! Although I'm not sure why you're bothering to copy the file to SP then delete it, you can retrieve and attach the file directly from OneDrive. Also note if you want a new folder every month you'll have to set that up separately and change this flow to map to the new folder which will mean changing the folder in the trigger using an expression to get the name of the current month...

    Anyway, depending on the file type of the attachment you might have some problems, but I tested the below with a PDF attachment and it worked!

     

    email-attachments-1.jpgemail-attachments-2.jpgemail-attachments-3.jpg

  • Zitallis Profile Picture
    31 on at

    Thank you so MUCH!

     

    Maybe we don't need to delete the files nor bothering attaching it to the list.

     

    That said, how can I ensure my invoice will go to the specific company or individuals automatically?  Do I require to set up a flow for each individual email that'll be receiving the file?  

     

    Say I have file names like:

    ABC Company_Inv - need to send to aaa@anemail.com; bbb@anemail.com; and ccc@anemail.com

    BBB Company_Inv - need to send to zzz@anemail.com; yyy@anemail.com; and iii@anemail.com

    CCC Company_inv - need to send to www@anemail.com; lll@anemail.coml and 555@anemail.com

    Zitallis_0-1676580103523.png

     

  • selfy100 Profile Picture
    228 on at

    That would make a much more efficient flow, for sure.

    I would add a column to the list of recipients with something like a company code and then filter the Get Items action to only find email addresses for list items with that code. So your list would look like this

    Screenshot 2023-02-17 at 1.53.36 PM.png

    You would name the invoice file ABC_inv.pdf for example, then you would need to create a simple Compose action to retrieve the company code from the file name by selecting all the letters before the underscore

    first(split(outputs('Add_attachment')?['body/DisplayName'],'_'))

    Then you could adjust the Get Items action to filter the list to find only items with ABC as their company code

    Screenshot-2023-02-17-at-2.57.34-PM.jpg

    Otherwise the steps remain the same!

    If this solves your problem, don't forget to mark it as a solution so other people with similar problems can find it!

  • Zitallis Profile Picture
    31 on at

    @selfy100 I really appreciate your time and response.   Let me test it out and being a non-coder, it will take me some good time to figure the easiest thing in your eyes... lol 

    I will follow up on this thread sometime next week to provide an update! 

  • Zitallis Profile Picture
    31 on at

    @selfy100 If I am NOT going to attachment the PDF to the List items, will I just skip the three SharePoint steps and jump directly to the "compose"? 

    Zitallis_0-1677121780820.png

     

  • selfy100 Profile Picture
    228 on at

    Skipping the step of moving the file into sharepoint makes the flow MUCH simpler. I ran the below flow and it worked!

    email-attachments-a.jpg

     

    first(split(triggerOutputs()?['headers/x-ms-file-name-encoded'],'_'))

    email-attachments-b.jpg

    email-attachments-2.jpg

  • Zitallis Profile Picture
    31 on at

    @selfy100  You're phenomenal! I will try it in a little and hopefully I can get it without must hand-holding.  I will keep you posted.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard