Building and customizing solutions using Microsoft 365 Copilot APIs and tools
In the new Copilot Studio experience, attachments can still be captured and passed on, but the pattern is different from the classic Topics-only approach and must be wired explicitly so that the file content and name are sent correctly to flows or connectors.
Key points for the new experience:
- Turn on file input and capture the attachment
- Use a Question node with Identify → File and enable Include file metadata to let the user upload a file during the chat.
- Alternatively (or additionally), use a Set variable value node with:
This captures an already-attached file (for example, from Teams) as a record withFirst(System.Activity.Attachments).Nameand.Contentfields.
- Pass the file to a Power Automate (agent) flow
When escalating via email, the most reliable pattern in the new experience is to use an agent flow (Power Automate flow) and pass the file explicitly:
- In the topic, after the Question/variable node that gets the file, add an agent flow.
- Configure the flow to accept a file-like input and pass it from the topic using a Power Fx record:
or, if using{ contentBytes: Topic.userReceipt.Content, name: Topic.userReceipt.Name }System.Activity.Attachmentsdirectly:{ contentBytes: First(System.Activity.Attachments).Content, name: First(System.Activity.Attachments).Name } - Inside the flow, this object can then be used to send the file to downstream systems (for example, to a ticketing system or via Outlook/Exchange connectors).
- Pass the file when the flow is added as a tool
If the escalation email is sent from a workflow/flow used as a tool:
- Go to Tools in Copilot Studio and open the flow tool.
- Under Inputs, ensure the flow has
contentBytesandnameinputs (add them if missing). - Set the inputs using
System.Activity.Attachments:// contentBytes First(System.Activity.Attachments).Content // name First(System.Activity.Attachments).Name - In the flow, mark the corresponding input as File type where applicable.
- Pass the file to connectors (for example, Outlook Send Email)
For connectors that expect file attachments (such as Send an email (V2)), the attachment input must be a table of records with
contentBytesandnamekeys. For example:
or, using[ { contentBytes: Topic.userReceipt.Content, name: Topic.userReceipt.Name } ]System.Activity.Attachments:
This pattern avoids corrupted content by matching exactly what the connector expects.If( IsEmpty(System.Activity.Attachments), [], [ { contentBytes: First(System.Activity.Attachments).Content, name: First(System.Activity.Attachments).Name } ] ) - Important constraint in the new Tools UI
On the Tools page, file inputs only work when configured as a Custom value with a Power Fx formula. They do not work when using Dynamically fill with AI for file inputs. For attachment scenarios, always:
- Use Custom value.
- Bind to
System.Activity.Attachmentsand shape the record/table to match the connector or flow input.
- Summary for a service desk front-line agent
For a front-line service desk agent that collects screenshots/files and escalates via email:
- Capture the file using a Question node or
First(System.Activity.Attachments). - Use an agent flow or connector tool where
contentBytesandnameare explicitly mapped from that attachment. - For Outlook/Send Email connectors, provide a table of
{ contentBytes, name }records as shown above.
ContentBytes. - Capture the file using a Question node or
References: