I need to associate the column to a term set using PowerShell.

Library name: Financial

Managed metadata column: Doc Type

MMS name: Managed Metadata Service Application

Group name: Project Management

Term set name: Project Taxonomy (v1.0)

Parent term: Financial

Term to be associated to the column: Doc Type


Try it as below:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$FieldName="Doc Type"

$Web = Get-SPWeb $WebURL
$List = $Web.Lists[$ListName]


 $TaxonomySession = Get-SPTaxonomySession -Site $web.Site
 $TermStore = $TaxonomySession.TermStores["Managed Metadata Service"]
 $TermGroup = $TermStore.Groups["Project Management"]
 $TermSet = $TermGroup.TermSets["Project Taxonomy (v1.0)"]  

 $TaxonomyField = $List.Fields.CreateNewField("TaxonomyFieldType", $TermSet.Name)
 $TaxonomyField.SspId = $TermSet.TermStore.Id
 $TaxonomyField.TermSetId = $TermSet.Id

 #Add the field to List

 Write-host "Managed metadata column Added successfully!"-f Green
 Write-host "Managed metadata column with the specified name already exists!"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.