Posted by: R Manimaran | August 31, 2013

Exclude the SharePoint Field from Crawling

Sometimes we used to create some Site Columns which needs to be used for Programmatic Purpose. When using the SharePoint Search we don’t want the values in such fields to be crawled and resulted in the SharePoint Search.

This can be done by using the Property “ No Crawl”.

Powershell Script to Set the Property


if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)

{

    Add-PSSnapin "Microsoft.SharePoint.PowerShell"

}

function SetNoCrawlProperty(string $FieldName,Microsoft.SharePoint.SPSite $site)

{

$field = $site.RootWeb.Fields[$FieldName]

if($field -ne $null)

{

$field.NoCrawl = $true

$field.Update($true)

}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: