SharePoint 2013/2016/Online Content Search WebPart with Query String

SharePoint 2013 Online Content Search WebPart with Query String

Content search web part is a very useful web part where we can display items based on various search criteria. In this post, we will discuss how we can filter records based on the query string parameter value in a content search web part in SharePoint 2013/2016/Online.

Here in this example, we will display items from a particular list based on a query string parameter. And we will filter here in the Title column. Here I have a SharePoint 2013 list which has more than 10 items in it. I want to show items based on a query string parameter value in a content search web part.

SharePoint deveopment training course

For this, I have created a SharePoint 2013 web part page and then added a content search web part in the page from the Content Rollup web part categories.

Then Edit the web part and click on Change query in the web part properties.

SharePoint 2013 Online Content Search WebPart with Query String
SharePoint 2013 Online Content Search WebPart with Query String

This will open the Build Your Query wizard where you can build your query. In the basic tab, I have modified the filter. In the Select a query I have selected “Items related to current user (System)“.

In the Restrict by an app, I have selected Specify a URL and I have mentioned by list URL. This I have chosen because I want the records to come from a particular list only not from the whole site. You can choose according to your requirement.

In the Restrict by tag, I select Don’t restrict by any tag. The whole should look like below:

SharePoint 2013 Online Content Search WebPart with Query String
SharePoint 2013 Online Content Search WebPart with Query String

Then click on Switch to Advanced Mode link in the same dialog box. By default you should see like below:

SharePoint 2013 Online Content Search WebPart with Query String
SharePoint 2013 Online Content Search WebPart with Query String

Now in the Keyword filter select “Value of a parameter from URL“.

Now in the Property filter, select “Show all managed properties” as shown in the fig below:

SharePoint 2013 Online Content Search WebPart with Query String
SharePoint 2013 Online Content Search WebPart with Query String

Now in the Property filter choose “Title” and then Contains and then in the Select Value choose “Value of a parameter from URL”. It should look like below:

SharePoint 2013 Online Content Search WebPart with Query String
SharePoint 2013 Online Content Search WebPart with Query String

The expression will appear like below:
Title:{QueryString.MyParameter1}

Here MyParameter1 is the query string parameter id. You can change it to any name you want. Here I have changed like below:

Title:{QueryString.ItemTitle} and it should looks like below:

SharePoint 2013 Online Content Search WebPart with Query String
SharePoint 2013 Online Content Search WebPart with Query String

Now Save the page and browse the URL like below:

https://onlysharepoint2013.sharepoint.com/Pages/TestSearch.aspx?ItemTitle=Items

So it will display items whose Title contains the word “Items” as shown in the fig below:

SharePoint 2013 Online Content Search WebPart with Query String
SharePoint 2013 Online Content Search WebPart with Query String

You may like following SharePoint 2013 search tutorials:

Hope this will be helpful to SharePoint 2013/2016/Online Content Search WebPart with Query String.

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

About 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 SharePointSky.com

View all posts by Bijay Kumar →