Table of contents
TOC
Collapse the table of content
Expand the table of content

Set-PnPTaxonomyFieldValue

Bert Jansen|Last Updated: 2/20/2017
|
1 Contributor

Sets a taxonomy term value in a listitem field

Syntax

Set-PnPTaxonomyFieldValue -ListItem <ListItem>
                          -InternalFieldName <String>
                          [-Terms <Hashtable>]
Set-PnPTaxonomyFieldValue -TermId <GuidPipeBind>
                          -ListItem <ListItem>
                          -InternalFieldName <String>
                          [-Label <String>]
Set-PnPTaxonomyFieldValue -TermPath <String>
                          -ListItem <ListItem>
                          -InternalFieldName <String>

Parameters

ParameterTypeRequiredDescription
InternalFieldNameStringTrueThe internal name of the field
ListItemListItemTrueThe list item to set the field value to
TermIdGuidPipeBindTrueThe Id of the Term
TermPathStringTrueA path in the form of GROUPLABEL
LabelStringFalseThe Label value of the term
TermsHashtableFalseAllows you to specify terms with key value pairs that can be referred to in the template by means of the {id:label} token. See examples on how to use this parameter.

Examples

Example 1

PS:> Set-PnPTaxonomyFieldValue -ListItem $item -InternalFieldName 'Department' -TermId 863b832b-6818-4e6a-966d-2d3ee057931c

Sets the field called 'Department' to the value of the term with the ID specified

Example 2

PS:> Set-PnPTaxonomyFieldValue -ListItem $item -InternalFieldName 'Department' -TermPath 'CORPORATE|DEPARTMENTS|HR'

Sets the field called 'Department' to the term called HR which is located in the DEPARTMENTS termset, which in turn is located in the CORPORATE termgroup.

Example 3

PS:> Set-PnPTaxonomyFieldValue -ListItem $item -InternalFieldName 'Department' -Terms @{"TermId1"="Label1";"TermId2"="Label2"}

Sets the field called 'Department' with multiple terms by ID and label. You can refer to those terms with the {ID:label} token.

© 2017 Microsoft