diff --git a/packages/graph/taxonomy/types.ts b/packages/graph/taxonomy/types.ts index a9f58510b..db0c7fd1c 100644 --- a/packages/graph/taxonomy/types.ts +++ b/packages/graph/taxonomy/types.ts @@ -77,16 +77,14 @@ export class _TermSet extends _GraphInstance { * * @returns Array of children for this item */ - public async getAllChildrenAsTree(): Promise { + public async getAllChildrenAsTree(props?: {retrieveProperties?: boolean}): 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(...selects)(); for (let i = 0; i < children.length; i++) { const child = children[i]; - const orderedTerm: Partial = { children: [], defaultLabel: child.labels.find(l => l.isDefault).name, @@ -99,9 +97,15 @@ export class _TermSet extends _GraphInstance { } }; + let selects = ["*"]; + if(props?.retrieveProperties){ + // graph does not let us wildcard + select properties + selects=["id", "labels", "createdDateTime", "lastModifiedDateTime", "labels", "descriptions", "properties"]; + } + const tree: IOrderedTermInfo[] = []; - await visitor(this, tree); + await visitor(this, tree); return tree; }