Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am creating a Document Set for a library using powershell and that document set contains some mandatory managed metadata fields. I am able to create document set but how can I insert data into those managed metadata fields at runtime?

share|improve this question

2 Answers 2

You have to connect to the term store and then construct a TaxonomyFieldValue and then use the target field's SetFieldValue() method to assign the value.

See here: http://social.technet.microsoft.com/Forums/da-DK/sharepointadminprevious/thread/4c63fff1-8681-42a1-9fd2-256f1f80935b

regards, KS

share|improve this answer
The link which you have provided is applicable for List managed metadata column. But, I have to add value into Document Set managed metadata column. Still not able to figure out... –  Lalit Kumar Mishra Oct 31 '12 at 3:44
Just for information -- the column in which i have to insert data is a site column which added into the Document Set content type. –  Lalit Kumar Mishra Oct 31 '12 at 3:46

Hope this helps someone.

You have to get a reference to the Managed metadata item from term store as shown below

$someTerm = $term.Terms | where-object {$_.Name -eq "SomeTerm" }

Create the document set as shown below

[Hashtable]$docSetProperties = @{}
$newDocumentSet=Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($list.RootFolder,"TestDocSet",$DocContentType.Id, $docSetProperties )

Get a reference to the inserted document set

$id = $newDocumentSet.Item.ID
$spItem = $list.GetItemById($id)

Get a reference to the taxonomy field from the inserted document set

$taxMMField = $spItem.Fields['YourManagedMetaDataField'] -as   [Microsoft.SharePoint.Taxonomy.TaxonomyField]
$taxMMField.SetFieldValue($spItem, $someTerm)

Call the Update method on the item


This will update the Managed metadata field in the Document Set.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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