Disable list or libraries to appear in search result SharePoint Online Office 365

This SharePoint search tutorial explains, how to disable lists or document libraries to appear in the search result in SharePoint Online Office 365.

All list and libraries search settings are enabled to appear in the search results. But there could be a few lists and libraries which you might like to display in the search result. SharePoint out of the box list settings option is available where you can enable/disable the option.

Go to List Settings -> Advanced Settings -> Select yes/No for Search section. Refer below screenshot for further reference.

disable list to appear in search results sharepoint

If you have a lot many list and libraries where these changes need to be done. Let’s write CSOM and PowerShell script to automate the process.

PowerShell Script to remove list to be appearing from SharePoint Search Result

Below is the PowerShell script to remove the list to be appearing from SharePoint Search Result.

cls
$0 = $MyInvocation.MyCommand.Definition
$dp0 = [System.IO.Path]::GetDirectoryName($0)
$username = “sambita@***.com”
$password = “****”
#$url = $xmldata.WebSite.Url
$url =’https://***.sharepoint.com/sites/test/’
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
# connect/authenticate to SharePoint Online and get ClientContext object..
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword)
$clientContext.Credentials = $credentials

Add-Type -Path “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll”

Add-Type -Path “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll”

Add-Type -Path “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Publishing.dll”

Add-Type -Path “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Taxonomy.dll”

if (!$clientContext.ServerObjectIsNull.Value)
{
Write-Host “Connected to SharePoint Online site: ‘$Url'” -ForegroundColor Green
$web = $clientContext.Web
$clientContext.Load($web)
$list=$clientContext.Web.Lists.GetByTitle($ListName)
$list.NoCrawl = $NoCrawl
$list.Update()
$clientContext.ExecuteQuery()
}

You may like following SharePoint PowerShell tutorials:

Hope this article will be helpful to disable list or libraries to appear in search result SharePoint Online Office 365.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

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

>