pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
740 stars 300 forks source link

How are we supposed to work with taxonomy now? How do we get PathofTerms or Parents? #3068

Closed zumiek closed 3 weeks ago

zumiek commented 3 weeks ago

What version of PnPjs library you are using

4.x

Minor Version Number

1.1

Target environment

SharePoint Framework

Additional environment details

Node 18.18.2

Question/Request

Can you please explain how we are supposed to work with taxonomy now? I have a termGuid and I'm trying to work my way up to the TermSet directly under the TermGroup, but if I try your current example "Get Term Parent" an error is returned: "Parsing OData Select and Expand failed: Could not find a property named 'parent' on type 'microsoft.graph.termStore.term'."

Also getAllChildrenAsOrderedTree is not available anymore, it's now getAllChildrenAsTree. So is the idea that we are supposed to use getAllChildrenAsTree recursively for all terms under the termset until we have everything, and then search through the results to get the ParentTree for the original term? Or is there another way to get the parent of a term?

Some guidance on how to work with taxonomy in v4 would be much appreciated.

bcameron1231 commented 3 weeks ago

Hi. So a couple things I'd like to touch on.

First, we certainly understand the frustration here with Taxonomy. During our transition from V3 to V4, we made the tough decision to move from the SharePoint v2.1 endpoints to Microsoft Graph, in hope to ensure the long term support of the API endpoints we use and to follow Microsoft's continue progression of moving towards the Graph API. We believe this is in the best interest of the library to move away from the v2.1 SharePoint endpoints.

In doing so, we lost some functionality within the Taxonomy module. We lost the ability to search() terms, the ability to getChildrenAsAtree (which we were able bring back), and functionality with parent terms. This unfortunately is a result of Microsoft not supporting this functionality in Graph, even though it existed in the old v2.1 endpoints.

In regard to your current issues, our documentation is incorrect. That select "parent" on a term was left over from the previous docs during our transition. Unfortunately parent, isn't a property of a term, so there is no way to retrieve the parent term when you're given a term id.

github-actions[bot] commented 3 weeks ago

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.