Search content from specific list or document library in SharePoint Online/2013/2016

This SharePoint search tutorial explains, how we can limit search results to specific SharePoint list or document library in SharePoint 2013/2016/Online using SharePoint 2013 Content Search web part. The content search web part is used to display contents from the search index and the search result can be easily formatted in SharePoint 2013/2016/Online.

Here I have a list name as TestList in the SharePoint site and I want to make a page and want to put a search box inside the page. And once the user tries to search by putting some keyword in the search box, it should only get results from that SharePoint 2013 list, TestList.

You can configure these things either from the search results page if you have created any or we can do this in a new web part page.

Here first we will create a web part page in the site. Here is a useful article on how to create a web part page using SharePoint 2013.

Once we create the web part page, you can edit the page and then click on “Add a Web Part” link from the web part zone. Then from the Search web part categories and select “Search Results” web part and then again click on Add a Web Part and this time add a “Search Box” web part from the Search categories. Now your page should look like below:

 Search content from specific SharePoint 2013 list SharePoint Online

Search content from specific SharePoint 2013 list SharePoint Online

Now Edit the Search Result Web part. And from the Edit web part properties dialog box. Click on Change query as shown in the fig below:

 Search content from specific SharePoint 2013 list SharePoint Online

Search content from specific SharePoint 2013 list SharePoint Online

Now in the Query text box put like below:
{SearchBoxQuery} {?{searchTerms} path:”https://onlysharepoint2013.sharepoint.com/Lists/TestList/”}

As you can see I have given the List path in the Path attribute. It looks like below:

Search content from specific SharePoint 2013 list SharePoint Online

Search content from specific SharePoint 2013 list SharePoint Online

Now click on OK and Save the Page. Now when you will try to search one item, the results will appear from TestList only.

Search content from specific SharePoint 2013 list SharePoint Online

Search content from specific SharePoint 2013 list SharePoint Online

You may like following SharePoint search & Rest API tutorials:

Hope this SharePoint search tutorial will be helpful to search content from a specific list or document library in SharePoint Online/2013/2016.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SPGuides.com

>