Normally a crawled property in SharePoint Search is added, when you do a full crawl on your content. That means, when you create a new list or library, you can use the fields of it to configure a managed property not until the full crawl has finished. But using PowerShell we are able to add a crawled property, even when the content is not already crawled.

To perform the steps to add a crawled property and a managed property, we can use the cmdlets New-SPEnterpriseSearchMetadataCrawledProperty and New-SPEnterpriseSearchMetadataManagedProperty. To map the crawled property and the managed property, we can use the cmdlet New-SPEnterpriseSearchMetadataMapping.

Here is a simple example:

New-SPEnterpriseSearchMetadataCrawledProperty -Category SharePoint -IsNameEnum $false -Name "ows_CrawledPropertyTest" -PropSet 00130329-0000-0130-c000-000000131346 -SearchApplication "Search Service Application" -VariantType 0
 
New-SPEnterpriseSearchMetadataManagedProperty -Name "CrawledPropertyTest" -SearchApplication "Search Service Application" -Type 1 -Queryable $true -Retrievable $true
 
$cp = Get-SPEnterpriseSearchMetadataCrawledProperty -SearchApplication "Search Service Application" "ows_CrawledPropertyTest"
 
$mp = Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication "Search Service Application" -Identity "CrawledPropertyTest"
 
New-SPEnterpriseSearchMetadataMapping -SearchApplication "Search Service Application" -CrawledProperty $cp -ManagedProperty $mp

 

The value for the parameter Propset was taken from the output of Get-SPEnterpriseSearchMetadataCrawledProperty. The value 00130329-0000-0130-c000-000000131346 is used for the most ows_… crawled properties.

Advertisements