Set-PnPTaxonomyFieldValue

Tip

We encourage you to make improvements to this documentation. Please navigate to https://github.com/pnp/powershell/blob/dev/documentation/Set-PnPTaxonomyFieldValue.md to change this file.

Sets a taxonomy term value in a listitem field

Syntax

Set-PnPTaxonomyFieldValue
   -ListItem <ListItem>
   -InternalFieldName <String>
   -TermId <Guid>
   [-Label <String>]
   [-Connection <PnPConnection>]
   [<CommonParameters>]
Set-PnPTaxonomyFieldValue
   -ListItem <ListItem>
   -InternalFieldName <String>
   -TermPath <String>
   [-Connection <PnPConnection>]
   [<CommonParameters>]
Set-PnPTaxonomyFieldValue
   -ListItem <ListItem>
   -InternalFieldName <String>
   [-Terms <Hashtable>]
   [-Connection <PnPConnection>]
   [<CommonParameters>]

Examples

EXAMPLE 1

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

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

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.

Parameters

-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:PnPConnection
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InternalFieldName

The internal name of the field

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Label

The Label value of the term

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ListItem

The list item to set the field value to

Type:ListItem
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TermId

The Id of the Term

Type:Guid
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TermPath

A path in the form of GROUPLABEL|TERMSETLABEL|TERMLABEL

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Terms

Allows 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.

Type:Hashtable
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False