I want to get a term by its synonym. For example, I have unique synonyms and I want to get the term and other synonyms using this unique synonym. All using powershell. is there a way to do that?
0
In each term, there is a labels property, which stores the primary label and the synonym using the "isDefaultLanguage" flag...
$TermGroupName="TermGroup"
$TermSetName="TermSet"
$Site="http://mysharepointsite/"
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy")
$session = New-Object Microsoft.SharePoint.Taxonomy.TaxonomySession($Site)
$termStore = $session.TermStores["Managed Metadata Service Application Proxy"]
$group = $termStore.Groups[$TermGroupName]
$termSet = $group.TermSets[$TermSetName]
$terms = $termSet.GetTerms(1000)
foreach($term in $terms){
$labelsyn=$term.Labels|?{$_.IsDefaultForLanguage -eq $false}
write-host $term.name ',' $labelsyn.value
}
Assuming you only have one synonym per term, this should at least get you close.