Skip to content

ferrarirosso/react-copilot-apis

Repository files navigation

react-copilot-apis

Summary

An SPFx webpart to explore and test the Microsoft 365 Copilot APIs (beta) through an interactive, tabbed interface: Retrieval and Search.

Built as a developer showcase tool — tweak parameters, compare results, inspect raw JSON, and build intuition for how the Copilot APIs behave.

Retrieval API

Retrieval API

Search API

Search API

Blog post

You can find additional information about this sample in my blog post Exploring the Microsoft 365 Copilot APIs with an SPFx Webpart

Features

Tab API Endpoint What it does
Retrieval POST /beta/copilot/retrieval AI-powered semantic search with relevance scores, metadata field discovery, KQL filtering
Search POST /beta/copilot/search Keyword search with pagination, path-based scoping, and preview text with highlighting

Additional capabilities:

  • Dynamic SharePoint managed property discovery (no hardcoded field lists)
  • Request/response JSON inspector with diff comparison
  • Structured debug log viewer with timing metrics

Compatibility

SPFx 1.22.1 Node.js v22 Compatible with SharePoint Online Does not work with SharePoint 2019 Does not work with SharePoint 2016 (Feature Pack 2) Teams Incompatible Hosted Workbench Compatible Compatible with Remote Containers

Applies to

Get your own free development tenant by subscribing to Microsoft 365 developer program

Prerequisites

  • Microsoft 365 tenant with Microsoft 365 Copilot licenses (the beta APIs require Copilot to be enabled)
  • SharePoint admin access to approve API permissions
  • The following Microsoft Graph delegated permissions must be approved in SharePoint Admin Center > API access:
Permission Used by
Sites.Read.All Retrieval, Search
Files.Read.All Retrieval, Search
ExternalItem.Read.All Retrieval

Version history

Version Date Comments
1.0 February 2026 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

All Copilot APIs used in this webpart are in beta and subject to change. Do not use in production without understanding the implications of beta API usage.


Minimal Path to Awesome

  • Clone this repository

  • Ensure that you are at the solution folder

  • in the command-line run:

    • npm install
    • npm run build
  • Upload sharepoint/solution/react-copilot-apis.sppkg to your App Catalog

  • When deploying, the App Catalog will prompt you to trust the solution and list the required Graph permissions:

    Permissions request on deploy

  • Approve the API permissions in SharePoint Admin Center > API access

  • Add the "Copilot API Showcase" webpart to any modern SharePoint page

About

SPFx webpart to explore and test the Microsoft 365 Copilot Retrieval, Search, and Chat APIs (beta)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors