1

Is anybody know what is the PnP PowerShell command for Reuse Term and Pin Term functionalities?

2 Answers 2

2

You can't do this using only PnP commands. But you can do it by dropping down to a little bit of CSOM.

First, fetch your source term and your destination term.

$pinnedTerm = Get-PnPTaxonomyItem -TermPath "Conglomo|Departments|Research and Development"
$sourceTermSet = Get-PnPTaxonomyItem -TermPath "Conglomo|Sitemap|Department Sites"

Then, call the one of the CSOM methods to reuse.

# option 1: reuse
$sourceTermSet.ReuseTerm($pinnedTerm, $true)

# option 2: reuse with pinning
$sourceTermSet.ReuseTermWithPinning($pinnedTerm)

Then you need to load and execute.

(Get-PnPContext).Load($pinnedTerm)
Invoke-PnPQuery
1
  • Thanks Derek. I will try your approach and let you know if any questions. Aug 14, 2018 at 15:00
0

option 1: reuse

$sourceTermSet.ReuseTerm($pinnedTerm, $true)

option 2: reuse with pinning

$sourceTermSet.ReuseTermWithPinning($pinnedTerm)

The above statements are INCORRECT - see below for working code:

#PIN TERM WITH CHILDREN - Unable to do it in PnP Schema (supported by the schema but NOT by the engine)!!
$termStore = Get-PnPSiteCollectionTermStore

$pinnedTerm = Get-PnPTaxonomyItem -TermPath "$($localTaxonomySession)|Site Navigation" $sourceTermSetDirectorates = Get-PnPTaxonomyItem -TermPath "National Trust|Site Navigation|Directorates"

$pinnedTerm.ReuseTermWithPinning($sourceTermSetDirectorates )

(Get-PnPContext).Load($pinnedTerm)
Invoke-PnPQuery

$termStore.CommitAll() # Added this to ensure persistance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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