![]()
In this “Copilot Studio Add Attachment Tool” article, we will learn how to add attachments in SharePoint List using the Copilot Studio add attachment tool and how to read attachments from the SharePoint Online List using the Copilot Studio Get attachments tool.
Basically, in this article, we will learn how to work with the “Add attachment” and “Get Attachments” tools in Copilot Studio. As a use case, I will extend my previous employee leave management article, where I have shown how to create a new list item in SharePoint using the Copilot Studio create item tool without any Power Automate flows with a low-code/no-code approach. So, let’s get started.
How to work with the Copilot Studio Add Attachment and Get Attachments tool?
In this article, I will first show how to work with the add attachment tool, and then I will show you how to work with the get attachments tool.
Copilot Studio Add attachment tool
As I said, I will extend my leave management list in this demo where employees can attach the supporting files after creating a new leave request. For that, I need to first add an “Add attachment” tool and a “Get attachments” tool in my Copilot Studio tool.
In my Copilot Studio agent, already I have added the “Add attachment” and a “Get attachments” tool, as you can see below:

Tools in Copilot Studio agentNow I will show the configuration of these two tools.
Configuration of add attachment tool
Configure only the inputs section of the add attachment tool and keep the rest as is with the default configuration. The following input configuration should be done:
- Site Address: Select your SharePoint Online site URL
- List Name: Select your list from the SharePoint site
- ID: Keep the default value (dynamically fill with AI)
- File Name: Select custom and pass this formula – First(System.Activity.Attachments).Name
- File Content: Select custom and pass this formula – First(System.Activity.Attachments).Content

That’s it from the add attachment tool configuration. Next, I will show the “Get attachments” tool configuration.
Get attachments tool configuration.
Configure only the inputs section of the Get attachments tool and keep the rest as is with the default configuration. The following input configuration should be done:
- Site Address: Select your SharePoint Online site URL
- List Name: Select your list from the SharePoint site
- ID: Keep the default value (dynamically fill with AI)

Note:
-
For both attachment tools, you can see the mandatory input configuration (with an asterisk * mark). You can add an optional column to the inputs section by clicking on the “Add input” button. This is optional; you can add it whenever you need it.
That’s it about the get attachments configuration. Now, I will take you to the instructions section of my agent.
Instructions configuration in Copilot Studio Agent
For my leave management with file attachment use case below are my instructions or prompts:
Leave Request Flow – Step-by-Step Instruction
Step 1: Create Leave Request
-
Prompt the user to provide:
- From Date
- To Date
- Comments
-
Calculate the number of leave days using:
Number of Days Leave = (To Date - From Date)
-
Use the Create Item tool to create a new leave request in the Leave Management SharePoint list with the following fields:
- Title: Use the format
"Leave Request – <Employee Name>"(automatically retrieved from user input) - EmployeeName: Automatically capture the name of the person submitting the request
- From Date: User input
- To Date: User input
- Comments: User input
- Number of Days Leave: Calculated automatically
- LeaveStatus: Set to
"Submitted"
-
Once the request is created, capture and return the following fields to the user:
- ID → Store in variable
{myItemID} - Title
- Employee Name
- From Date
- To Date
- Comments
- Number of Days Leave
Step 2: Attach File to Leave Request
-
Ask the user:
“Would you like to attach a file to this leave request?” -
If the user says Yes:
-
Allow the user to upload a file
-
Query the Leave Management list using the
Get Itemtool, whereItem ID = {myItemID}-
Display a message: “Leave request item ID found: {myItemID}”
-
-
Once the file is received, call the Add attachment tool
-
Pass Item ID as
{myItemID} -
Return the uploaded file URL to the user for confirmation
-
-
Query again the Leave Management list using
Get attachmentstool whereItem ID = {myItemID}-
Display all attached files back to the user
-
-

Basically, in this instruction, the agent is designed to help users create and manage leave requests in SharePoint Online using Copilot Studio tools in a step-by-step process.
First, the agent collects the user’s input, including From Date, To Date, and Comments, then automatically calculates the number of leave days and submits the data to a SharePoint Online Leave Management list using the Create Item tool.
After submission, the agent stores the unique Item ID of the newly created leave request for further use. The user is then asked if they want to attach any files to their leave request. If they agree, the agent allows file upload and uses the Add Attachment tool to link the uploaded files to the corresponding SharePoint list item using the stored Item ID.
The agent confirms successful attachment by querying the Leave Management list and displays the attached files back to the user. This automation flow enhances HR task management and streamlines leave tracking in SharePoint Online using Copilot Studio.
These instructions follow best practices for SharePoint leave request automation, file attachment in SharePoint list item, how to use Copilot Studio with SharePoint Online, and automate HR workflows with Microsoft Copilot, making the process efficient and user-friendly.
Demo: Add attachment and Get Attachments tool
Start your agent in test mode and pass this prompt “I want to apply leave from 4th August to 7th August for my personal reason.”. Then your new leave request will be created in the SharePoint leave management list.
Then, the agent will ask the user, “Would you like to attach a file to this leave request?” Once the user says “yes,” the user can upload a file from their local drive, and then that file will be attached to the leave request the user just created. This all will happen automatically.

And after attaching the file, that will be displayed to the user.

I can see this file attachment from my SharePoint leave management list item. The below shown file has been attached to my new leave request using my agent’s add attachment tool.

Note:
- While you are uploading a new file to SharePoint as an attachment, be aware of the limitation and quota in Copilot Studio, so I recommend you read this Microsoft article: Quotas and limits for Copilot Studio
YouTube Video Demo: Attachment in Copilot Studio
Summary
Thus, in this article, we have learnt how to use Add Attachment and Get Attachments tool in Copilot Studio to enhance the SharePoint Online leave request automation process. We explored how to collect user input for leave requests, create items in a SharePoint list, and seamlessly attach files to the list item using the unique Item ID. Additionally, we demonstrated how to retrieve and display attached files using the Get Attachments tool.
This end-to-end solution empowers users to build efficient, no-code HR workflow automation using Microsoft Copilot Studio with SharePoint Online, making tasks like file upload to SharePoint list item, leave request management, and SharePoint-based task automation faster, smarter, and more streamlined.