logo
search
SharePoint Document Issues

How to Restrict SharePoint Search Results for Lists and Libraries

Steven ParkerSteven Parker Oct 22, 2026 868 views

Question details

The user wants to prevent SharePoint users from finding items outside a specifically filtered list or library view and needs to hide the 'Expand search to all items in this site' option.

How to Restrict SharePoint Search Results for Lists and Libraries
Product
Microsoft SharePoint
Device & OS
not provided
Scenario
Managing search permissions and visibility limits within specific SharePoint lists or document libraries.
Observed behavior
SharePoint displays an 'Expand search to all items in this site' prompt by default, allowing users to search beyond the current filtered view without a native option to disable it.
Before you start

Ensure you have Site Owner or Administrator permissions in your SharePoint environment to modify search configurations, adjust list settings, or deploy custom web parts.

Solution 1Recommended

Implement PnP Modern Search Web Parts

Deploy the open-source PnP Modern Search solution to gain granular control over search experiences and prevent site-wide expansion.

Since SharePoint does not natively support hiding the site-wide search prompt for individual lists, PnP Modern Search is the community-standard workaround. It replaces the default search box with customizable web parts.

1
Download PnP Modern Search

Visit the official Microsoft Search GitHub repository and download the latest PnP Modern Search package.

2
Deploy to the App Catalog

Upload the downloaded package to your SharePoint Tenant App Catalog to make the web parts available across your sites.

3
Add Search Web Parts to your page

Create a new Modern Page, then add the 'PnP Search Box' and 'PnP Search Results' web parts to the page.

4
Configure the Query

Edit the PnP Search Results web part properties to restrict the query strictly to your targeted list or document library ID, effectively preventing outside searches.

Implement PnP Modern Search Web Parts
Developer Support: PnP Modern Search is an open-source project. If you encounter setup issues, you can consult the official documentation or post questions in their GitHub issues section.
Free Microsoft Office alternative

Manage Your Documents Seamlessly with WPS Office

While SharePoint search restrictions require advanced configuration, everyday document management shouldn't be complicated. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Office, offering an intuitive interface for editing, organizing, and securing your files.

  1. 1. Download the installer: Visit the official WPS website to download the free installation package for your operating system.
  2. 2. Install WPS Office: Run the downloaded installer and follow the on-screen instructions to complete the setup.
  3. 3. Open your files: Launch WPS Office and seamlessly open your existing Microsoft Office documents to start working immediately.
Fully compatible with Microsoft Word, Excel, and PowerPoint file formats.Lightweight software that loads quickly on virtually any device.Built-in robust PDF editing and conversion tools.Familiar user interface ensuring zero learning curve for Office users.Free to use for everyday office productivity and document management tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Does SharePoint have a native setting to disable 'Expand search to all items'?

No, SharePoint does not currently offer a built-in toggle or out-of-the-box setting to hide this specific search expansion prompt for individual lists or libraries.

Can I use folder-level permissions to restrict search results?

Yes, search results in SharePoint are security-trimmed. If you remove a user's read permissions from specific folders or items, those items will automatically disappear from their search results regardless of how they search.

How can I exclude an entire list from SharePoint search completely?

Go to List Settings, click on 'Advanced settings', scroll down to the 'Search' section, and select 'No' under 'Allow items from this document library to appear in search results?'.

Is PnP Modern Search free to use?

Yes, PnP Modern Search is a free, open-source solution provided by the Microsoft 365 community, though deploying it requires SharePoint tenant administrator privileges.