diff --git a/packages/graph/taxonomy/types.ts b/packages/graph/taxonomy/types.ts index a9f58510b..929909602 100644 --- a/packages/graph/taxonomy/types.ts +++ b/packages/graph/taxonomy/types.ts @@ -79,29 +79,28 @@ export class _TermSet extends _GraphInstance { */ public async getAllChildrenAsTree(): Promise { - const visitor = async (source: { children(): Promise }, parent: IOrderedTermInfo[]) => { - - const children = await source.children(); - + const visitor = async (source: ITerm | ITermSet, parent: IOrderedTermInfo[]) => { + + const children = await source.children.select('id', 'descriptions', 'createdDateTime','labels', 'lastModifiedDateTime')(); + for (let i = 0; i < children.length; i++) { - + const child = children[i]; - const orderedTerm: Partial = { children: [], defaultLabel: child.labels.find(l => l.isDefault).name, ...child, }; - + parent.push(orderedTerm); - + await visitor(this.getTermById(child.id), orderedTerm.children); } }; const tree: IOrderedTermInfo[] = []; - await visitor(this, tree); + await visitor(this, tree); return tree; }