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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add PDF attachment to ...
Power Automate
Answered

Add PDF attachment to email

(2) ShareShare
ReportReport
Posted on by 6
Hello, 
 
I have created an Agent in copilot studio to automatically reply to emails coming into our HR inbox. The Agent reads the email, researches using our policies and procedures on SharePoint, drafts a reply, and sends it back to myself for review. 
 
However, the email contains a link to the policy on SharePoint - which is fine, but I'd prefer for it to include an attachment of the policy document as everyone who emails us doesn't have access to our SharePoint site.
 
I've included this in my instruction on copilot studio but I've read I need to create this flow on Power Automate, and I have tried to use copilot for step by step instructrutions, but the codes have errors, or some of the steps are too confusing.
 
Does anyone know how this flow could be set up please?
 
Thank you. 
Copilot Studio Agent.png
Categories:
I have the same question (0)
  • chiaraalina Profile Picture
    1,860 Super User 2026 Season 1 on at
     

    You can do this with Power Automate, but in your scenario I would handle it with an Agent flow.

    Create an Agent flow under Tools (think of it like a custom tool, similar to the prebuilt Outlook tool). In that flow you can:

     
    1. Add SharePoint – Get file content for the policy PDF
    2. Use Outlook – Send an email (V2) and populate the Attachments
     
     
     

    Then in Copilot Studio, call that Agent flow right where you currently send yourself the draft for review.

    Hope that helps a little and let me know if you want to try it and if you need help with that.

  • Verified answer
    Valantis Profile Picture
    2,530 on at

    I totally get your frustration. Most tutorials mix up two different approaches here, and it's driving people crazy.
    I've found the following for your request:

    The core issue: If you want your Agent to actually think about the email first, you can't use "When a new email arrives" as the trigger. That's just dumb automation. The Agent needs to be in control.

    What should happen:
    • Agent reads the email and finds the right policy
    • Agent calls your flow with the filename and draft text
    • Flow grabs the file from SharePoint and emails it to you for review
    Setting up the flow:
    Create a new Instant Cloud Flow called something like "Example Policy Fetcher". Set the trigger to "Run a flow from Copilot" with two text inputs: PolicyFileName and DraftReply.
    Add a SharePoint get files action for your library. In advanced options, add this filter query: FileLeafRef eq 'ExamplePolicy.pdf' (use the PolicyFileName input here).
    SharePoint always returns a list, so add an Apply to each loop using the value from get files. Inside the loop, add a SharePoint get file content action using the Identifier from the previous step, then add a send email action to yourself. Put the DraftReply text in the body and add attachments using Name with extension and File Content from the previous steps. Save it.

    Connecting the Agent:
    Go back to Copilot Studio and add a call action step for your flow. Map DraftReply to the Agent's response text and PolicyFileName to the filename variable.
    Here's the critical part: add this to your topic instructions: "When you find a relevant policy in the Knowledge Source, extract the exact filename including the .pdf or .docx extension and pass it to the PolicyFileName field."

    The filename problem everyone hits:
    If your file is named CompanyPolicy_2024_v2.pdf but the Agent sends "Company Policy", it'll break. To fix this, change your filter to use fuzzy matching. Replace FileLeafRef eq with: substringof('your text here', FileLeafRef). Some SharePoint versions use contains(FileLeafRef, 'your text here') instead. This way the Agent doesn't need perfect filename accuracy.

    What you end up with:
    Agent reads the email, figures out which policy is needed, and passes the info to your flow. The flow finds the document in SharePoint and emails you with the draft text and PDF attached. You review it and send it yourself.

    Let me know if that worked out for you. :)
  • Valantis Profile Picture
    2,530 on at

    Hi @JH-17120836-0 

    I hope the solution helped! Just wanted to check in and see if everything is working now. If you still need any help, feel free to let me know.

    Also, if the issue is resolved, it would be great if you could mark the answer as solved so others with the same question can find it easily.

     

    Thanks and have a great day!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard