Disable content on a SharePoint site to be searchable

In this SharePoint tutorial, we will discuss how to disable content on a SharePoint site to be searchable. Follow the steps to exclude SharePoint site or list from search results. The exact steps you can follow to exclude SharePoint site or list from search results in SharePoint 2013, SharePoint 2016 and SharePoint 2019 also.

Disable content on a SharePoint site to be searchable

Now, first, let us see how to disable content on a SharePoint site to be searchable and we will see in the SharePoint Online site.

One the SharePoint Online site and navigate to the Site settings page.

If you are using modern SharePoint site, click on the gear icon -> Site information -> View all site settings.

And if you are using classic SharePoint site, then click on Gear icon -> Site settings.

Then in the Site settings page, then click on Search and offline availability that is under Search section.

Disable content on a SharePoint site to be searchable

In the Search and Offline Availability page select No for Allow this site to appear in search results? in the Indexing Site Content section.

sharepoint exclude document from search
sharepoint exclude document from search

Once you save the page, it will exclude the SharePoint site from search result.

Exclude SharePoint list or library from search results

Now, we will see how to exclude SharePoint list or library from search results. There will be scenarios where we might not want to documents or list items to appear in the search result. We might want to exclude a particular library from the SharePoint search.

By following the below approach we can exclude a particular SharePoint list or document library from the SharePoint search results.

Open the SharePoint list or Library and then click on the List settings or Library settings page like below:

exclude sharepoint list or library from search results

Then click on Advanced settings which is under General Settings of the library settings page.

exclude sharepoint site or list from search results

Then in the Search section, select No for Allow items from this document library to appear in search results?

SharePoint 2013 exclude documents from search results

Once you click on Save the document library will not appear in the SharePoint search results.

SharePoint 2013 exclude documents from search results (unique permission)

We can also exclude documents from SharePoint search results by providing unique permission. You can assign unique permission to a particular SharePoint list, library, or even to a particular document.

Once you set unique permission to a document or document library, only people who has permission can see the document in the SharePoint search result.

Those who will not have permission, can not see the document in the SharePoint search result.

I have written a few complete articles, you can follow for SharePoint unique permission.

Disable content on a SharePoint site to be searchable usig PowerShell (SharePoint Online)

Now, let us see how to disable content on a SharePoint Online site using PowerShell.

Here we will use PowerShell CSOM.

Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
$siteUrl = "https://tsinfo.sharepoint.com/sites/TSInfoClassic/"
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$credentials= Get-Credential
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.Username, $credentials.Password)
$web = $ctx.Web
$ctx.NoCrawl = $True
$ctx.Update()
$ctx.ExecuteQuery()

Once you run the PowerShell script, if you will go to the Search and Offline availability, you will see No selected for Allow this site to appear in search results.

Exclude SharePoint site from search result using PnP PowerShell

Now, we will see how to exclude SharePoint site from search result using PnP PowerShell.

Connect-PnPOnline -Url https://tsinfo.sharepoint.com/sites/spguides -Credentials (Get-Credential)
$web = Get-PnPWeb
$web.NoCrawl = $true
$web.Update()

Disable content on a SharePoint site to be searchable using PowerShell (SharePoint on-premise)

Now, we will see how we can disable content on a site to be searchable using PowerShell in SharePoint 2013.

Below is the PowerShell script you can use.

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
$web=Get-SPWeb -site https://<your-SharePoint2013-URL>
$web.NoCrawl = $true
$web.Update()

In this tutorial, we learned how to disable content on a SharePoint site to be searchable. I hope this article will help to solve the below queries.

You may like the following SharePoint search tutorials:

  • Disable content on a SharePoint site to be searchable
  • enable content on a SharePoint site to be searchable
  • sharepoint exclude document from search
  • how to make sharepoint documents searchable
  • Prevent documents from appearing in search results in sharepoint
  • SharePoint 2013 exclude few documents from search results
  • how to exclude site from search result in SharePoint
  • exclude sharepoint site or list from search results
  • exclude sharepoint list or library from search results
>