logo
search
SharePoint Document Issues

How to Add Custom Search by ID or Company Name in SharePoint Document Library

Chanuka GeekiyanageChanuka Geekiyanage Oct 13, 2026 870 views

Question details

The user wants to implement a custom search bar above a SharePoint document library to allow users to search for specific files using metadata such as ID number, company name, or year.

How to Add Custom Search by ID or Company Name in SharePoint Document Library
Product
Microsoft SharePoint
Device & OS
not provided
Scenario
Organizing and retrieving files in a large SharePoint document library based on specific metadata criteria rather than general keyword matching.
Observed behavior
A customizable search interface is deployed directly above the library, enabling end-users to input criteria and instantly retrieve files by their assigned ID, company name, or other metadata.
Before you start

Ensure you have Site Owner or Full Control permissions for your SharePoint site, and verify that the target metadata columns (like ID or Company Name) are already created, populated, and indexed in your document library.

Solution 1Recommended

Configure Search Using PnP Modern Search Web Parts

The most effective way to add metadata-specific search functionality is by utilizing the PnP Modern Search web parts, which offer highly customizable search boxes and result displays tailored to specific libraries.

PnP Modern Search is an open-source solution provided by Microsoft patterns and practices. It provides extensive flexibility for querying and displaying SharePoint content compared to the out-of-the-box search bar.

1
Deploy PnP Web Parts

Ensure that the PnP Modern Search web parts package (.sppkg) is deployed to your SharePoint tenant's App Catalog and added to your specific site by a SharePoint Administrator.

2
Add the Search Box Web Part

Navigate to the SharePoint page where your document library resides, click 'Edit' in the top right corner, and insert a 'PnP - Search Box' web part above the document library area.

3
Add the Search Results Web Part

Below the search box, click the '+' icon to add a new web part and select 'PnP - Search Results'.

4
Connect the Web Parts

Click the pencil icon to edit the Search Results web part settings. Navigate to the query configuration, turn on 'Use input query text', and connect it to the PnP Search Box you just created.

5
Target the Document Library

In the Search Results properties, modify the Query Template to target your specific library path (e.g., Path:"https://domain.sharepoint.com/sites/yoursite/libraryname*"). This restricts the search results to that specific document library.

Configure Search Using PnP Modern Search Web Parts
Map Managed Properties: For custom metadata like 'Company Name' to be searchable via specific queries (e.g., CompanyName:"Contoso"), ensure the corresponding crawled properties are mapped to refinable managed properties in the SharePoint Admin Center Search Schema.
Free Microsoft Office alternative

Manage Your Office Documents Effectively with WPS Office

While configuring complex SharePoint libraries requires specific Microsoft 365 setups, everyday document creation and editing doesn't have to be complicated. WPS Office provides a lightweight, free alternative to Microsoft Office, offering an intuitive interface to handle all your daily tasks effortlessly.

  1. 1. Download the Installer: Visit the official WPS Office website to download the free, lightweight installer for your Windows, Mac, or Linux machine.
  2. 2. Install and Launch: Follow the simple installation prompts. Once installed, launch the application to access the all-in-one suite.
  3. 3. Open and Search Documents: Use the global search bar on the WPS homepage to instantly find your local Word, Excel, PowerPoint, and PDF files without complex configurations.
Fully compatible with Microsoft Office formats, including .docx, .xlsx, and .pptx.Organize and search your local documents easily with a clean, tabbed workspace.Lightweight installation that runs smoothly without heavily taxing system resources.Includes built-in PDF editing, conversion tools, and rich templates.
microsoft office alternative - wps office

Frequently Asked Questions

Can I use the default SharePoint search to find files by company name?

Yes, the default search box located at the top of a document library can find files by metadata if the columns are properly indexed. However, it lacks the customizable interface, specific targeted filters, and dedicated layout provided by the PnP Modern Search web parts.

Why aren't my custom metadata columns showing up in SharePoint search results?

Custom site columns need to be mapped to Managed Properties in the SharePoint Search Schema. After mapping them, you must wait for a site re-index or the next continuous crawl to process the changes before those fields become searchable.

Do I need admin rights to install PnP Modern Search web parts?

Yes, a SharePoint Tenant Administrator needs to deploy the PnP Modern Search package (.sppkg file) to the central App Catalog first. Once deployed globally or to the specific site collection, Site Owners can then add and configure the web parts on individual pages.