Teams / SharePoint · Community sample

Microsoft 365 Search Hub

A custom Microsoft 365 search experience built on the Microsoft Search API in Microsoft Graph. Demonstrates the architecture behind a search web part rather than the search box itself.

Teams tabWeb partReactSPFx 1.23.2
Search results across documents, pages and sites, with filters and sort in a toolbar

The idea behind the sample

Searches documents, pages, sites and list items through the Microsoft Search API in Microsoft Graph, from one search box, with a single Sites.Read.All permission.

The sample exists for the case where the search that comes with SharePoint does not fit the problem and somebody has to write code: a page where search belongs among the other content, a portal where only certain sites matter, or results that need the organisation's own context on them.

What it demonstrates is the architecture. Query building and result normalisation are pure functions; concurrency lives in one service, with debounce, a short cache, superseded responses discarded and paging; the interface is composed from Fluent UI v9 with the SharePoint theme bridged onto it, and a denied permission, an expired sign-in, throttling and a service error each get a state of their own rather than one generic failure.

Built on SPFx 1.23.2 with the Heft toolchain. 163 unit tests cover the query building, result normalisation, cache, service and search state, including the races between debounce, superseded responses and unmount.

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

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.