Our HR team regularly updates policy documents, including leave policies, codes of conduct, and remote work guidelines, and stores them in a SharePoint library. We use a chatbot called Policy Assistant Bot, built in Copilot Studio, to answer employee questions based on these documents.
However, every time we update a file, we must manually upload it again to the Agent as a knowledge file. It’s time-consuming, easy to forget, and creates a gap between updated documents and what the bot can answer.
Therefore, I created a Power Automate flow to upload the file.
Now, whenever someone adds a policy document in SharePoint, the flow automatically adds that file to Policy Assistant Bot’s knowledge base. The bot always stays in sync without manual work.
In this tutorial, I’ll show you how to create a Power Automate flow that automatically adds files to Copilot Studio Knowledge. I’ll also explain the file size limits you need to be aware of, both when uploading manually and when using Power Automate.
Create a Flow to Add Knowledge Files to Copilot Studio
Before we build the flow, ensure your Copilot Studio Agent is ready. This Agent will receive the knowledge files and respond to user questions based on them.
So let’s get started to add Copilot Studio knowledge files using Power Automate step by step.
Create a Copilot Studio Agent (Policy Assistant Bot)
This Agent will use uploaded documents, such as HR policies, leave guidelines, or employee handbooks, to automatically respond to employee questions.
Go to Copilot Studio, click + Create > + New Agent, skip the configuration step, enter the Agent name and description, then click create, or use an existing Agent you’ve created earlier.

We’ll handle that automatically using Power Automate, so you won’t need to add anything to the Agent yourself.

Create a SharePoint Document Library
To store and manage your policy documents, you’ll need a dedicated SharePoint document library. This is where your Power Automate flow will monitor for new files and send them to your Copilot Agent.

Create a Power Automate Flow to Upload Knowledge Files
Now that your SharePoint document library and Copilot Studio Agent (Policy Assistant Bot) are ready, let’s build the flow that will automatically upload policy documents to the Agent’s knowledge base.
- Go to Power Automate. Click Create > Automated cloud flow. Choose the trigger: When a file is created (properties only) (SharePoint). Select the SharePoint site and Library Name (“Policy Documents”).

When an agent (Copilot) is created in Copilot Studio, a corresponding record is stored in the Dataverse table named Copilots.
- To retrieve the details of the newly created agent, use the List rows action for Microsoft Dataverse in Power Automate and provide the following parameters:
- Table name: Select Copilots
- Filter rows:
name eq 'Policy Assistant Bot'

Now we’ll store the Agent ID of our Policy Assistant Bot in a variable so we can reuse it later in the flow when adding a Knowledge File to the Copilot Studio.
- Add a new Initialize variable action with the following parameters:
- Name: varCopiloteId
- Type: String
- Value: Provide the below expression:
first(outputs('List_rows')?['body/value'])?['botId']

Whenever we upload a file to the Agent, a record gets created in the Copilot components table in Dataverse. To avoid uploading duplicates, we’ll query this table to check if the file is already there.
- Add a List rows action from the Dataverse connector and configure it as follows:
- Table name: Copilot components
- Select columns: name
- Filter rows:
_parentbotid_value eq @{variables('varCopiloteId')}
This filter ensures we only retrieve components (such as knowledge files) linked to the specific Copilot Agent we’re working with.

The List rows action gives us a full list of components (including various details), but we only need the file names to check whether the current file has already been uploaded. To simplify this, we’ll use the Select action to extract just the name property of each item.
- Add a Select action with the following parameters:
- From: @{outputs(‘List_rows_1’)?[‘body/value’]}
- Map: Click the small T Icon to switch to text mode. Then enter the following expression:
@{item()?['name']}

This will create an array containing only the names of all existing knowledge files in the Copilot components table. We’ll use this list to verify whether the current file already exists.
Now that we have a list of all existing knowledge file names, let’s add a Condition to check if the current SharePoint file already exists in that list.
- Add a Condition action and use the following expression:
@{body('Select')} does not contain @{triggerBody()?['{FilenameWithExtension}']}

- In the true section, add a Get file content action (from the SharePoint connector) with the following parameters:
- Site Address: Select the SharePoint site where your policy documents are stored.
- File Identifier: Use the following expression from dynamic content:
@{triggerBody()?['{Identifier}']}

Once you retrieve the file content, you can now register the file as a knowledge component by adding a new row to the Copilot components table in Dataverse.
- Add an ‘Add a new row‘ action (from the Dataverse connector) and configure it as follows:
- Table name: Copilot components
- ComponentType: Bot File Attachment
- SchemaName:
cr0e5_policyAssistantBot.file.@{triggerBody()?['{FilenameWithExtension}']}
- Expand the Advanced parameters section and fill in:
- Description: Power Automate Flow adds Knowledge.
- Name: @{triggerBody()?[‘{FilenameWithExtension}’]}
- parentbotid (Copilots): Parentbotid lookup field to indicate which Agent owns the component:
/bots(@{variables('varCopiloteId')})

After you add the metadata to the Copilot components table, you need to upload the actual file content (binary data). We do this using the ‘Upload a file or an image’ action in Power Automate.
Tip:
If you’re unsure how to find the correct schema name, scroll down to the Find Schema Name in Dataverse section.
- Add an Upload a file or an image action (Dataverse connector) and configure the following:
- Content name: @{triggerBody()?[‘{FilenameWithExtension}’]}
- Table name: Copilot components
- Row ID: @{outputs(‘Add_a_new_row’)?[‘body/botcomponentid’]}
- Column name: filedata
- Content: @{body(‘Get_file_content’)}

After uploading the file to Dataverse and linking it to your Agent, you need to publish the changes so the file becomes active and usable in Copilot Studio.
We’ll do this by calling the PvaPublish action on the Copilots table in Dataverse.
- Add a ‘Perform a bound action‘ action (Dataverse connector) and configure it as follows:
- Table name: Copilots
- Action Name: PvaPublish
- Row ID: @{variables(‘varCopiloteId’)}

This action will trigger the publishing process for the selected Copilot Agent, in this case, your Policy Assistant Bot. Once published, the newly uploaded knowledge file will become available in the bot’s knowledge base.
Note:
In the “False” branch of the condition (i.e., the file already exists in the Agent’s knowledge base), you may want to notify the person responsible that the file is already present. This helps avoid unintentional duplicate uploads.
Test Copilot Studio Agent To Upload a File
Once your flow is complete, it’s time to test the full automation and ensure everything works as expected.
Save your flow in Power Automate. Go to your SharePoint document library (Policy Documents). Upload a large file (you can test with something over 7MB to confirm the benefit).
Tip:
Make sure your file name does not contain spaces. For example: Power_Platform_EBook.pdf

Once the flow runs successfully, follow these steps to confirm the file has been added to your Agent:
- Go to Copilot Studio.
- Open your Policy Assistant Bot.
- Navigate to Knowledge.
You will see the uploaded file listed there. Its status may initially show as “In progress.” This means Copilot Studio is still processing the file and extracting the content.

After a few minutes, you’ll see the file’s status change from “In progress” to “Ready.”

Once the file status shows ‘Ready’, proceed to test your Policy Assistant Bot. Click Test your bot inside Copilot Studio.

Find Schema Name in Dataverse
To get the correct Schema Name for your Agent’s knowledge files, follow these steps:
- Go to Power Apps > Tables.
- Search for the Copilot components table.
- In the data view, filter the ComponentType column by Knowledge Source.
- Look at the SchemaName column; you should see values related to your Agent name. The format typically looks like this:
<your publisher prefix>_<agent name>.

Still Can not Find the Schema Name
If you don’t see anything in the list:
- Manually add a knowledge file to your Agent from the Copilot Studio.
- Then return to the Copilot components table.
- This time, filter ComponentType by Bot File Attachment.
- You should now see a SchemaName that matches your Agent, which you can use in the Power Automate flow.
Copilot Studio Knowledge Limit
Copilot Studio only allows manual uploads of up to 7MB, and even with a trial license, this limit remains unchanged. If you’re using a licensed version, you can upload files up to 200MB but only through the Copilot Studio interface.
With Power Automate, you can go even further. You can upload knowledge files up to 512MB directly to your Agent.
With this Power Automate flow, you no longer need to upload files to your Policy Assistant Bot manually. Whenever someone adds a new policy document to SharePoint, the bot is automatically updated.
Also, you may like some tutorials:
- Export key attribute for component must begin with a letter Power Automate
- Create Multi Agent in Copilot Studio
- Add Copilot to Power Apps
- Add a List in Power Pages
- Create a Power Apps Weather App
- Add a Multistep Form in Power Pages

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.