ASP.net;sharepoint
c# moss 程序人生
 

创建搜索元数据映射

$searchapp=Get-SPEnterpriseSearchServiceApplication

New-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $searchapp -Name mei -Type 2 -Description "苏梅华"

$mei = Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $searchapp -Identity mei

$cmei=Get-SPEnterpriseSearchMetadataCrawledProperty  -SearchApplication $searchapp -Name Return.Series

$cmei1=Get-SPEnterpriseSearchMetadataCrawledProperty  -SearchApplication $searchapp -Name Return.Subscribes

New-SPEnterpriseSearchMetadataMapping -SearchApplication $searchapp -CrawledProperty $cmei -ManagedProperty $mei

New-SPEnterpriseSearchMetadataMapping -SearchApplication $searchapp -CrawledProperty $cmei1 -ManagedProperty $mei

 

效果图:

 

 

如果没有删除映射,删除元数据时会提示错误

 

删除搜索元数据:首先先删除搜索元数据映射

$PSSnapinSharePoin = Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction silentlycontinue

if( $PSSnapinSharePoin -eq $Null)

{

Add-PSSnapin Microsoft.SharePoint.PowerShell;

}        

$searchapp = Get-SPEnterpriseSearchServiceApplication

$mp = Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $searchapp -Identity su

$mapmei = Get-SPEnterpriseSearchMetadataMapping -SearchApplication $searchapp -ManagedProperty $mp

foreach($_ in $mapmei)

{

$prop = Get-SPEnterpriseSearchMetadataCrawledProperty -SearchApplication $searchapp -Name $_.CrawledPropertyName

$map = Get-SPEnterpriseSearchMetadataMapping -SearchApplication $searchapp -CrawledProperty $prop -ManagedProperty $mp

$map | Remove-SPEnterpriseSearchMetadataMapping

}

$mp | Remove-SPEnterpriseSearchMetadataManagedProperty

posted on 2011-05-06 11:02  sumh  阅读(381)  评论(0编辑  收藏  举报