문제

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

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top