Monday, 12 February 2018

How to set search on a specific Document library in SharePoint Online


Applies to SharePoint Online / O365
If you have a requirement for to show search results from a specific Document library, here are the things you can do


Step 1.

Add a Search box
Step 2.

On the Search box > Properties > Send queries to a Custom search result >  Provide the URL > https://XXXX.sharepoint.com/sites/KnowledgeCenter/SitePages/SearchResults.aspx?u={contexturl}

This is the new result page you will be creating in Step 3

Step 3.

Create a Search result page (any new page) and add a Search result webpart

Step 4.




Search Results Property > Search Criteria > Change Query > You can add the below in query text 

To set the scope to a document library add "Path" and the path to exclude a path use "-Path"

Eg - 

{searchboxquery} Path:https://XXXXsharepoint.com/sites/KnowledgeCenter/Lists/Posts/  
-Path=https://XXXX.sharepoint.com/sites/KnowledgeCenter/Lists/Posts/StandardView.aspx

Step 5.

Run the "Test Query" and confirm the result set 

All done, Hope this helps.



Exclude accounts from the SharePoint online search results

Implemented on SharePoint Online

Business asked me to fix the SharePoint Online search site when it started pulling external users and showing System accounts.

Googled did'nt have much luck, spend hours.

Blogging as it will be usefull to someone. 

The key is use "Search Core Results" webpart and then fine tune the query to bring in results and filter and show.