Copilot · Community sample

Lists and items on a site

The tutorial project that shows the lists on a SharePoint site, and the items in the list the user selects, from a site URL the agent passes to the tool.

Copilot componentJavaScriptSPFx 1.24.0-beta.5
Microsoft 365 Copilot showing the lists on a SharePoint site in the MyCopilotApp component after the user asked for the lists on the site

The idea behind the sample

The finished project for the tutorial Connect your Copilot UX component to SharePoint data. It's the my-copilot-app project from Build your first SharePoint Copilot App with the tutorial changes applied.

The agent passes a site URL to the MyCopilotAppTool tool in the siteUrl parameter. The MyCopilotApp component uses spHttpClient to show the lists on that site and the first 25 items of the list the user selects. It handles a missing URL, a URL that isn't a site, a site the user can't access, and a site that doesn't exist. The component uses no framework, and all code runs in the browser.

Make it your own

Start with the author's setup instructions, explore the implementation, and adapt the pattern to your environment. Sample code stays in its original repository, together with its requirements, license and contribution history.

Read the source documentation

A closer look

Keep exploring

Keep the ideas flowing

Back to all possibilities
Microsoft 365 and Power Platform Community Contributor badge

Sharing is caring.

Share what you know.

Contribute a sample, improve the docs or help someone get started. Sample contributors can opt in to the PnP Recognition Program and share their community contributor badge.

Have something to show? Sign up for a community call demo. Fill in the form and we'll arrange a slot based on your availability.