Skip to main content
Tweeted twitter.com/StackSharePoint/status/1101180406961983488
Bumped by Community user
edited title
Link
Rustam
  • 218
  • 2
  • 9

Get child terms of a particular taxonomy termsterm using CSOM

Source Link
Rustam
  • 218
  • 2
  • 9

Get child terms of a particular taxonomy terms using CSOM

I'm having trouble with SharePoint CSOM getting child terms using Term object's GetTerms method. In PowerShell using PnP PowerShell I do this:

PS C:\> $term = Get-PnPTerm -Identity "Regions" -TermSet "Location" -TermGroup "Common"
PS C:\> $childTerms = $term.GetTerms(100)
PS C:\> $term.Context.Load($childTerms)
PS C:\> $term.Context.ExecuteQuery()

Exception calling "ExecuteQuery" with "0" argument(s): "Specified argument was out of the range of valid values.
Parameter name: lcid"
At line:1 char:1
+ $term.Context.ExecuteQuery()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ServerException

I get the same error when I do this inside ASP.NET MVC application representing remote web in my SharePoint provider-hosted add-in.