My problem is I can't reuse a term under another term. But reuse term under a termset works fine. How can I reuse a term under another term. What I'm trying to do here just works fine with web interface. But when it comes to powershell, I'm stuck.

Code below works fine but it puts reused term in the root of the target termset. But the source term is under level 2, I mean it's under another term, not direcly under root.

$sourceterm = $mytermstore.GetTerm("66c67639-db8a-4101-8778-afbf10bef644");
$tset = $mytermstore.GetTermSet("186fcb82-4aea-4a79-b2dd-77b3895b533b")
$reusedTerm = $tset.ReuseTerm($sourceterm, $False)

I tried to use a term as target like below but I get error. Obviously term does not have ReuseTerm method.

$sourceterm = $mytermstore.GetTerm("66c67639-db8a-4101-8778-afbf10bef644");
$parentTerm = $mytermstore.GetTerm("186fcb82-4aea-4a79-b2dd-blah")
$reusedTerm = $parentTerm.ReuseTerm($sourceterm, $False)

I'm trying to reuse the existing term powershell2 under Courses under next termset Variations Navigation (tr)

enter image description here

  • Have you found answer for your above query? Thanks
    – user44734
    Aug 2, 2015 at 17:56

1 Answer 1


I am using PnP (PnP PowerShell overview) to get the term. Verify you are using the latest version. Check out this documentation to get the Client Taxonomy Term members. For the on-premise see here. Not sure the differences but always check these documentations dependent on your environment. (online or on-premise)

Method 1:

#SharePoint Online tenant
try {
    write-host "Logging-in using SPO"
    $credFMS = Connect-PnPOnline -Url $orgName -SPOManagementShell
    write-host "Logged-in"
} catch {
    write-host "Logging-in using WebLogin"
    $credFMS = Connect-PnPOnline -Url $orgName -UseWebLogin
    write-host "Logged-in"

#static values to test
$entityType="Managed Account"

#Gets the term store based on the connection. Since we are connected to the root site collection, it will get the root site collection Term Store
$sourceTermSetName = "TermSetSourceTestValue"
$targetTermSetName = "TermSetTargetTestValue"
$sourceTermGroupName = "TermGroupTestValue"
$targetTermGroupName = "TargetTermGroupName"

# Check if it exist first. "id" on the Where could be replaced with "Name" if you know the name of the term Where name -Name -eq $entityName
$sourceTerm = Get-PnPTerm -TermSet $sourceTermSetName -TermGroup $sourceTermGroupName | Where id -eq $entityGuid

if($sourceTerm.Count -gt 0) {
    #Found! - Reuse the term
    #Reuse term will place term under termset
    $targetParentTerm = Get-PnPTerm -Identity $entityType -TermSet $targetTermSetName -TermGroup $targetTermGroupName -Recursive
    $reuseTerm = $targetParentTerm.ReuseTerm($sourceTerm, $True)

Method 2: Even though the above worked for me, alternatively you can do the following using CSOM with PnP

#*** Connection / ****#
#Locate where your module files are located
$PathModule="C:\Program Files (x86)\SharePointPnPPowerShellOnline\Modules\SharePointPnPPowerShellOnline"
Add-Type -Path "$PathModule\Microsoft.SharePoint.Client.dll"
Add-Type -Path "$PathModule\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "$PathModule\Microsoft.SharePoint.Client.Taxonomy.dll"


try {
    write-host "Logging-in to $urlRoot using WebLogin"
    #return connection to this variable using the -ReturnConnection parameter
    # '-UseWebLogin' is used for browser log-in. Typically for multi-factor authentication environments
    $connectRoot = Connect-PnPOnline -Url $urlRoot -ReturnConnection -ErrorAction Stop -UseWebLogin
    write-host "Logged-in"
} catch { 
    write-host "Unable to login"
    #Exit script if unable to connect
#Get the current context
$Context = Get-PnPContext


#Taxonomy Session
$MMS = [Microsoft.SharePoint.Client.Taxonomy.TaxonomySession]::GetTaxonomySession($Context)
#Retrieve Term Stores
$TermStores = $MMS.TermStores
#Term Store
$TermStore = $TermStores[0]

#Source Group
$sourceGroup = $TermStore.Groups.GetByName($sourceGroupName)
#Target Group
$targetGroup = $TermStore.Groups.GetByName($targetGroupName)
#Source TermSet
$sourceTermSet = $sourceGroup.TermSets.GetByName($sourceTermSetName)
#Source Term
$sourceTerm = $sourceTermSet.Terms.GetByName($sourceTermEntityName)

#Create a term
$TermAdd = $sourceTermSet.CreateTerm("NewTerm436",1033,[System.Guid]::NewGuid().toString())

#Get the Target Term Set
$targetTermSet = $targetGroup.TermSets.GetByName($targetTermSetName)

#Get the Parent Term
$targetCategoryTerm = $targetTermSet.Terms.GetByName($targetCategoryTerm)

#Get the Child Term
$targetTypeTerm = $targetCategoryTerm.Terms.GetByName($targetEntityTypeTerm)

#Reuse Term to the Target Child Term
$targetTypeTerm.ReuseTerm($sourceTerm, $True)

# Create Single Label

#Create multiple Labels
#$Context.ExecuteQuery() # ExecuteQuery could be use here but since its called in the next lines, no need to call it now

#Get the labels collection
$sourceTermLabels = $sourceTerm.Labels

for ($i = 0; $i -lt $sourceTermLabels.Count; $i++)
    write-host "Label Name: "$sourceTermLabels[$i].Value " / Is Default: " $sourceTermLabels[$i].IsDefaultForLanguage

Write-Host "End"

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.