怎么用Power Automate把邮件里的附件发给Copilot Studio的代理?

人工智能 2026-07-12

I’m trying to trigger a Copilot Studio conversational agent from Power Automate when a new email arrives, and I want to pass the email’s attachment to the agent for analysis.

Here’s what I’ve done so far:

  • I created an agent in Microsoft Copilot Studio
  • I created a Power Automate flow that triggers “When a new email arrives (V3)”
  • I extract the attachments without any problem ;
  • Then I added the action “Run the assistant and wait”

My issue is:

There is no field to send a file or binary content to the agent.
I can only pass text fields (key/value pairs).
I cannot upload or attach a file in any way.

In Copilot Studio, I also don’t see any notion of “Actions” (like PVA used to have), nor any option to declare a File input parameter.


What I need to do

I want to send a prompt + the email attachment (typically PDF or DOCX) to my Copilot Studio agent so it can read/analyze it.

What I’ve tried

  • Searching for “File input” or “Attachment input” in agent variables → not available ;
  • Using Base64 content inside a text variable → the agent does not interpret it as a file ;
  • Trying "Run the assistant" vs "Run the assistant and wait" → same limitation ;
  • Confirmed that only JSON/text inputs are allowed in these actions.

My questions

  1. Is it currently possible to send a file to a Copilot Studio agent through Power Automate ? ;
  2. If not, what is the recommended workaround ? ;

  3. Upload to SharePoint and send the file URL? ;

  4. Custom connector? ;
  5. Enable some preview features ?.
  6. Does the new Copilot Studio experience remove file-type inputs entirely, or am I missing a configuration ?.

Environment

  • Microsoft 365 tenant (standard enterprise, no preview features enabled) ;
  • Copilot Studio (new UI, early 2026) ;
  • Power Automate cloud flow ;
  • Outlook trigger with attachments ;
  • Only available agent actions: “Run the assistant”, “Run the assistant and wait”.

解决方案

As of the current Copilot Studio experience (early 2026), there is no native way to pass a file/binary attachment directly to a Copilot Studio agent via the "Run the assistant" or "Run the assistant and wait" Power Automate actions. You're correct that these actions only support text/JSON key-value pair inputs.

Here is the recommended workaround using SharePoint as an intermediary:

1. Save the attachment to SharePoint

In your Power Automate flow, after extracting the email attachment, use the "Create file" action (SharePoint connector) to upload the attachment content to a SharePoint document library. For example, upload it to a folder like /EmailAttachments/ with the original filename.

2. Get the file URL or sharing link

After the file is created, use the "Get file properties" or "Create sharing link" action to obtain a direct URL to the file in SharePoint.

3. Pass the URL to the Copilot Studio agent

In the "Run the assistant and wait" action, pass the SharePoint file URL as a text input parameter (e.g., key: fileUrl, value: the URL from the previous step). You can also pass additional context like the filename, file type, and the user's prompt.

4. In Copilot Studio, configure the agent to handle the URL

In your Copilot Studio agent, you can create a Topic that receives the fileUrl input. Then use one of these approaches to process the file:

Use a Power Automate cloud flow action inside the agent to retrieve the file content from SharePoint (using "Get file content" with the SharePoint connector), convert it to text (e.g., for PDF/DOCX, extract text content), and return the text back to the agent for analysis.

Use an HTTP connector or custom connector if you need more advanced file processing (e.g., calling an Azure Function or AI service that can parse the document).

Example flow structure:

Email arrives → Extract attachments → Create file in SharePoint → Get file URL → Run the assistant and wait (pass URL + prompt as text inputs) → Agent receives URL → Agent calls a child flow to get & parse file content → Agent analyzes and responds

Important notes:

  • Copilot Studio agents can call Power Automate flows as "actions" (this replaced PVA's old Actions concept). In the new Copilot Studio UI, go to your agent → Actions → Add an action → select a Power Automate cloud flow. This is how you give the agent the ability to read the file from SharePoint.
  • Base64 encoding won't work as a workaround because the agent treats all inputs as plain text strings, and the size limits on text inputs would likely truncate large files anyway.
  • Make sure the agent's identity (or the connection used in the flow) has read access to the SharePoint library where you store the files.

This SharePoint-based pattern is currently the most reliable approach and is also recommended in Microsoft's documentation for scenarios where file processing is needed with Copilot Studio agents.

备选方案1

You are correct that, at the moment, it is not possible to directly pass binary files to the Copilot Studio agent from Power Automate. The “Run the assistant” action can only accept text-based input.

The typical workaround is to store the attachment somewhere and pass the URL instead. A general approach is:

1. Store the attachment

In the flow, triggered by the “When a new email arrives” (V3) action, use the “Create file” action in Microsoft SharePoint to store the email attachment.

A good practice is to use a unique identifier for the file, such as the Outlook message ID, to prevent conflicts if the file has the same name as other attachments.

2. Pass the URL to the agent

Pass the URL of the stored file as a text-based parameter to the agent using the “Run the assistant” action, along with the “Wait” action in Microsoft Power Automate.

Here is the example for the parameter:

fileUrl = https://tenant.sharepoint.com/sites/.../document.pdf

3. Use a child flow to parse the file

The agent will not be able to directly analyze the PDF or the DOCX file by accessing the URL. The general idea is to create a secondary flow from the agent:

  1. Get the file content by using the Get file content action
  2. Extract the content of the file by using AI Builder’s document processing feature
  3. Return the extracted content to the agent

At this stage, the agent will be receiving the content as a text format, which fits into the input format for the platform.

How the above works

Agents created with Copilot Studio are intended to operate with a text prompt rather than binary content. Getting the content of the document before sending it to the agent avoids any issues with the file type.

备选方案2

I also have the same requirements,

  1. i need to pass the PDF to Copilot agent.
  2. Copilot Studio calls the Power Automate AI Prompt.
  3. Extract the text and do further processing..

i tested the #2 and #3 by uploading the file manually in CoPilot Studio and it worked.

How to automate this ? I was trying to use Trigger --> when an email arrives--> its not working as mentioned in the above post.

What are the alternative options i have ..

pls help

Anilal

站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。

相关文章