Pnpjs: ITermSet::children.get() returns not all terms for large termsets

Created on 23 Sep 2020  路  3Comments  路  Source: pnp/pnpjs

Category

  • [ ] Enhancement
  • [x] Bug
  • [ ] Question
  • [x] Documentation gap/issue

Version

Please specify what version of the library you are using: [ 2.0.10 ]

Please specify what version(s) of SharePoint you are targeting: [ SharePoint online ]

Expected

import { sp } from '@pnp/sp-commonjs';
const TERMSET_GUID = 'xxxxxxxx-yyyy-zzzz-qqqq-uuuuuuuuuuuu';
...
const terms = await sp.termStore.sets.getById(TERMSET_GUID).children.select('id', 'labels').get();
console.log('loaded %d terms', terms.length);

should return something like "loaded 450 terms" for my flat termset

Observed Behavior

the code above should return about "loaded 200 terms"

Steps to Reproduce

  • create a flat termset with more than 200 terms
  • execute code above
code details needed question

Most helpful comment

Can you clarify... you have a termset with 200 terms like you mention in the "Steps to Reproduce" or you have a termset with 450 terms like the Expected section? If I'm interpreting your request correctly I think you're saying you have 450 child terms but you're only getting 200 in length, which I would suggest is probably the default returned set size from the endpoint, so you'll probably have to implement the .top option to pull a larger set at one time.

All 3 comments

Can you clarify... you have a termset with 200 terms like you mention in the "Steps to Reproduce" or you have a termset with 450 terms like the Expected section? If I'm interpreting your request correctly I think you're saying you have 450 child terms but you're only getting 200 in length, which I would suggest is probably the default returned set size from the endpoint, so you'll probably have to implement the .top option to pull a larger set at one time.

@juliemturner no, I have a flat termset with about 450 terms. So, expected behavior: "loaded 450 terms", observed behavior: "loaded 200 terms"

Thank you for the answer! I will try to use .top a large number, e.g. 100000...

Thank you, It worked!
maximal .top parameter is 5000, if the number is larger the following error comes:

Error making HttpClient request in queryable [400] Bad Request ::> {"error":{"code":"invalidRequest","message":"Invalid page request parameters."}}.
Was this page helpful?
0 / 5 - 0 ratings