I am using below PnP PowerShell command to create new Term.


In my case, I would like to create new term with custom properties under the existing term.

I can't find a way to do this. Is this possible? if yes how can I do this?

2 Answers 2


Per my research, PnP PowerShell does not support creating a sub term currently.

We can achieve that using CSOM.

1.Download the latest SharePoint Online Management Shell.

2.Install the SharePoint Online Client Components SDK.

3.Connect to SharePoint Online as a global admin or SharePoint admin in Office 365. To learn how, see Getting started with SharePoint Online Management Shell.

4.Run the following commands:

#Specify tenant admin and URL
$User = "<admin>@tenant.onmicrosoft.com"
$Site = "https://tenant.sharepoint.com/sites/<site>"
$GroupName = "TestGroup"
$TermSetName = "TestSet"
$Term = "test1"
$SubTerm = "subTest1"

#Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Taxonomy.dll"
$Password = Read-Host -Prompt "Please enter your password" -AsSecureString

#Bind to MMS
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($User,$Password)
$Context.Credentials = $Creds
$MMS = [Microsoft.SharePoint.Client.Taxonomy.TaxonomySession]::GetTaxonomySession($Context)

#Retrieve Term Stores
$TermStores = $MMS.TermStores

#Bind to Term Store
$TermStore = $TermStores[0]

#Bind to Group
$Group = $TermStore.Groups.GetByName($GroupName)

#Bind to Term Set
$TermSet = $Group.TermSets.GetByName($TermSetName)

#create term
$TermAdd = $TermSet.CreateTerm($Term,1033,[System.Guid]::NewGuid().toString())

#create subterm
$L2TermAdd = $TermAdd.CreateTerm($SubTerm,1033,[System.Guid]::NewGuid().toString())

More inforamtion:


  • I tried this approach but it's not working for me and I have created a separate issue on the same sharepoint.stackexchange.com/questions/244355/… Commented Jul 2, 2018 at 13:42
  • It's because the SharePoint Client Components SDK is missing. Check my steps above. Install SharePoint Online Client Components SDK. Download link: microsoft.com/en-us/download/details.aspx?id=42038 Commented Jul 3, 2018 at 1:15
  • I am running this on my OnPerm SP2016 server which comes with all DLL to work with CSOM. Still have to install this? If I install this then it will overwrite the existing one. Is that ok? Commented Jul 3, 2018 at 16:10
  • They are different. You need to install latest online SDK if you want to take advantage of the latest CSOM capabilities for SharePoint Online. Theoretically we use SharePoint Online CSOM with on-premises as well. We do however recommend on using right CSOM version for specific server side version to avoid issues. Refer to: dev.office.com/blogs/… You can install Online SDK and Management Shell in another server such as SQL server if you mind. Commented Jul 4, 2018 at 1:44
  • Thanks for the explanation. Accepting your answer coz I do not see a way to do this in PnP Commented Jul 5, 2018 at 18:22

I was able to get around this limitation with very little extra code When using the New-PnpTerm command, it will return a term object. Just call CreateTerm from that term object to create a child.

#First you must get the Context
$ctx = Get-PnPContext

#Create the new Parent Term
$newTerm = New-PnpTerm -Name "Pastel" -TermSet "Colours" -TermGroup "Company Colours" -Id "GUID"

#Use that parent to create the child term
$childTerm = $newTerm.CreateTerm("Blue", 1033, "New Term Guid")

#Have the context do the work

Not technically all PnP powershell, but it allowed me to get around the limitation.

  • Will give it a try in future Commented Nov 2, 2018 at 15:07

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.