Create Managed Metadata Property and Mapping

10/01/2012 20:58

$searchAppName="Enterprise Search Service Application"

$searchapp = Get-SPEnterpriseSearchServiceApplication $searchAppName
$category = Get-SPEnterpriseSearchMetadataCategory –Identity SharePoint -SearchApplication $searchapp

   #Creating Metadata properties
    
$CrawlPropertyName="ows_Avanade-GBP-PageLanguage"
$managedPropertyName="PageLanguageFromPS"
    
$crawledproperty = New-SPEnterpriseSearchMetadataCrawledProperty -SearchApplication $searchapp -Category "Sharepoint" -VariantType 31 -PropSet "00130329-0000-0130-c000-000000131346" -Name $CrawlPropertyName -IsNameEnum $false
$managedproperty = New-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $searchapp -Name $managedPropertyName -Type 1

New-SPEnterpriseSearchMetadataMapping -SearchApplication $searchapp -ManagedProperty $managedproperty -CrawledProperty $crawledproperty