Copilot Studio triggers
What you will build
Contoso Procurement, a fictional team, is in the Christmas rush. Quotes and statements of work land in a SharePoint folder called Incoming. Today someone opens each one, reads it and forwards it, and in December the deadlines slip through: a quote that expires, a guest list that is due, a notice period before an automatic renewal. In this lab, nobody types a prompt: the file itself wakes the agent.
One document, from SharePoint to Teams
π§ The agent
Contoso Procurement Watcher, on the Microsoft Copilot harness. Short instructions, no tools, no knowledge, no web search. It gets one document and judges it: supplier, amount, dates, and at most three points to watch.
β‘ The workflow
Supplier documents to Teams, a Copilot Studio workflow (not Power Automate). A SharePoint trigger, a condition, Extract, an Agent node that calls the agent, and a Teams post.
Before you start
- A Microsoft 365 test tenant where you can create a team in Microsoft Teams.
- A Power Platform environment with Dataverse and access to Copilot Studio, with Copilot Studio credits. One document costs about 30 credits.
- PowerShell 7 and Azure CLI, the Azure command-line interface (
az): install Azure CLI. - The lab files:
1The team, the channel and the folder
β±οΈ About 5 minutes
- In Microsoft Teams, create a team Contoso - Procurement (from scratch, private).
- In that team, add a standard channel Supplier documents.
- Open the team's SharePoint site: in the team, Files, then Open in SharePoint. Go back to the root of the Documents library.
- In Documents, create a folder Incoming. Keep this tab open: you will drop the documents here in step 4.
- Unzip the Christmas supplier documents into a folder on your computer, ready for drag and drop.
https://your-tenant.sharepoint.com/sites/contoso-procurement or similar).2The agent, on the Microsoft Copilot harness
β±οΈ About 5 minutes
- Put
watcher-instructions.txtandcreate-watcher-agent.ps1in the same folder. - Find your environment URL: Power Platform admin center, Environments, your environment, Environment URL (it ends with
.dynamics.com). Find your tenant identifier: Microsoft Entra admin center, Overview, Tenant ID. - In PowerShell 7, from that folder, sign in and run the script:
CREATED followed by an identifier, then PUBLISHED ... status=Succeeded after about 15 seconds. Run it again after editing the instructions: it updates the same agent and publishes again.- Open Copilot Studio, pick your environment, Agents, then Contoso Procurement Watcher, Build tab. Check: the instructions are there, no tools, no knowledge, web search off.
The instructions are short. Three rules carry the weight:
3The workflow
β±οΈ About 20 minutes
In Copilot Studio, same environment: Workflows, New workflow. Name it Supplier documents to Teams. Then add the nodes in this order.
- Trigger: SharePoint, "When a file is created (properties only)". Site Address: your Contoso - Procurement site. Library Name: Documents. Folder:
/Shared Documents/Incoming. - Condition (If/Else): File name with extension (from the trigger) ends with
.pdf. Put every following node in the branch where the condition is true. The other branch stays empty: the run stops there. - SharePoint, "Get file content". Site Address: the same site. File Identifier: Identifier from the trigger.
- Extract. Give it the File Content from "Get file content" as the document to read, and define these 11 output fields, all text:
Supplier,DocumentType,Reference,Amount,Term,Validity,Deadlines,Liability,PersonalData,RenewalAndNotice,OtherClauses. - Agent. Choose Contoso Procurement Watcher. In Message, paste the text below, then replace each value in braces with the dynamic value of the same name (from the trigger, or from Extract).
- Microsoft Teams, "Post message in a chat or channel". Post as: Flow bot. Post in: Channel. Team: Contoso - Procurement. Channel: Supplier documents. Message: the agent's answer (the result output of the Agent node).
- Save, Publish, and make sure the workflow is on. The editor may still show a "Draft" badge although the workflow is on: trust the workflow list.
4Drop the documents, one at a time
β±οΈ About 10 minutes
Open the Supplier documents channel next to the Incoming folder. The trigger checks the folder about every minute; a run took 38 to 45 seconds in rehearsal. Expect the post one to two minutes after the drop.
- Meeting notes - Christmas market planning.txt. Nothing appears in Teams. Not a PDF: the run stopped at the condition and the agent never woke up. You can see that run, short, in the workflow's Activity.
- Fabrikam - Quote Q-2026-118 Christmas lights.pdf. Expected: Fabrikam Festive Lights, a quote for 400 metres of garlands, 12 illuminated reindeer and a 4 metre tree for the Christmas market stand, EUR 18,600. Point to watch: the price is valid only until 4 December 2026, and installation is on 5 December.
- Litware - Statement of work staff Christmas party.pdf. Expected: Litware Events, reference LW-SOW-2026-77, EUR 27,000 fixed price for 220 guests on 18 December 2026. Points to watch: a data processing agreement before 1 December (the guest list holds names, emails and dietary requirements), final numbers by 4 December or a 50 percent cancellation cost, and liability capped at the contract amount.
- Northwind - Framework agreement 2027 gift wrapping.pdf. Expected: EUR 48,600 a year for 2027, prices up 4.5 percent, and it renews automatically unless notice is given before 2 October 2027.
5Inside one run, and a schedule
β±οΈ About 10 minutes
- In the workflow, open Activity and open the Litware run. Each node is green.
- Click Extract: the fields it pulled from the PDF. Then click Agent: the message it received and the answer it wrote. The fields are facts; the points to watch are the agent's judgement.
- Look at the cost: about 30 credits per document in rehearsal, about 24 for Extract and 6 for the agent. Measure it before you point the workflow at a folder that gets a hundred files a day.
- Optional: save a copy of the workflow and replace the trigger with Recurrence, every morning at 8:00. The same pattern becomes a daily digest. Event and schedule are the two kinds of trigger you will use most.
Before you turn on a proactive agent: 4 controls
A proactive agent spends credits on every run and can post in the wrong place. Nobody is there to catch it, so build the guardrails in.
- Scope the trigger. One folder, not the whole site. Ideally a library for the agent, not the one everybody writes to.
- Filter before the agent runs. Only PDFs reach the agent. A file it should ignore should never wake it.
- Read, never act. The agent summarises. It does not approve, sign, reply to the supplier, or move or delete the file.
- Watch it run. The workflow's Activity lists every triggered run: check it daily for the first week.
Lessons from building it
- "When a file is created (properties only)" passes metadata only: read the file in the workflow before the agent runs.
- Files dropped together arrive in one run: test one file at a time.
- The condition on
.pdfkeeps text files and images away from the agent, at zero credit. - Teams channel posts are HTML: ask the agent for simple HTML, never Markdown.
- Flow bot posts cannot be deleted: use a fresh channel for each clean run.
- About 30 credits per document, and 38 to 45 seconds per run.
Clean up
- Turn off the workflow Supplier documents to Teams (or delete it) in Copilot Studio, Workflows.
- Delete the files you dropped in Incoming.
- Delete the agent Contoso Procurement Watcher in Copilot Studio if you no longer need it.
- Delete the team Contoso - Procurement when you are done: it removes the channel and the site with it.

← All labs