Pergunta

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

Foi útil?

Solução

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

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top