1

$newmp =Set-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $ssa -Identity

has anyone used this method, i have been trying to work with it, i have been successful in setting description and retrievable, the rest of the properties such as searchable,sortable have boolean values but i cant set any of them does any one have the correct code to using it. thanks

2 Answers 2

2

According to the documentation, Set-SPEnterpriseSearchMetadataManagedProperty doesn't allow you to update these properties through this particular commandlet. What I've used in the past is something like the following:

Function Update-ManagedProperty([string]$name) 
{
    $ssa = Get-SPEnterpriseSearchServiceApplication;
    $mp = Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $ssa -Identity $name;

    $mp.Searchable = $true;
    $mp.Queryable = $true;
    $mp.Sortable = $true;
    $mp.Retrievable = $true;
    $mp.Refinable = $true;
    $mp.Update();

    $mp | Write-Output;
}
2
  • thank you so much that did it. any idea how to update mapping as that function does not support updating mappings please and thank you. Commented Jul 20, 2018 at 16:06
  • Do you know how I could do the same action but on sharepoint online ? thanks Commented Apr 29, 2020 at 15:34
0

Use this script to update the managed property:

 $LogTime = Get-Date -Format yyyy-MM-dd_hh-mm
 $LogFile = ".\UpdateManagedPropertyPatch-$LogTime.rtf"

 #start-transcript $logfile

 # Add SharePoint PowerShell Snapin


 if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) {
     Add-PSSnapin Microsoft.SharePoint.Powershell
 }

 $scriptBase = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent
 Set-Location $scriptBase

 $OutputPath = $scriptBase + "\" + "ManagedPropErrors.txt"


 if (test-path $OutputPath)
 {
     remove-item $OutputPath
 }


 $csvfile = $scriptBase + "\" + "EditManagedProp.csv"
 Import-csv $csvfile | where {

 $searchapp = Get-SPEnterpriseSearchServiceApplication

 $ManagedProperty = Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $searchapp -Identity $_.ManagedPropertyName -ea silentlycontinue

 if($ManagedProperty)
 {
     $ManagedProperty.Searchable = $true
     $ManagedProperty.Queryable = $true
     $ManagedProperty.Sortable = $true
     $ManagedProperty.Retrievable = $true
     $ManagedProperty.Refinable = $true
     $ManagedProperty.SafeForAnonymous = $true
     $ManagedProperty.update()
     write-host "The searchable, queryable, Sortable, Retrievable and Refinable for the managed property" $_.ManagedPropertyName "has been enabled successfully ...... Done !" -fore green
 }
 else
 {
     Write-Host -f Yellow "The specified managed property " $_.ManagedPropertyName " does not exists... Please check whether you have given valid managed property name"
     $a = "The specified managed property " + $_.ManagedPropertyName + " does not exists... Please check whether you have given valid crawled property name"| out-file $OutputPath -append
 }


 }
 #stop-transcript 

Reference:

How To Update Managed Property As Searchable, Queryable, Sortable, Refinable, Retrievable In SharePoint 2013 Using PowerShell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.