Episode #113 – SharePoint Online Taxonomy API via Microsoft Graph
Here you can find the transcript of Episode #113 of PiaSys TechBites.
Welcome back to PiaSys TechBites, I’m back from a short summer break. And while I was on vacation, Microsoft wanted to make me happy, really happy. In fact, in August 2020, they released under the beta endpoint of Microsoft Graph the support for the taxonomy API in SharePoint Online. As such nowadays using the beta endpoint of Graph, we can access the whole term store. We can get access to a specific term group to the term sets of that group and to the terms inside of a term set. And we can also play with relationships, which nowadays can be a peer relationship or a reuse relationship. So let me move to the demo environment. Let me show you how you can play with these fresh new taxonomy APIs. So like always let’s start from the documentation and under the beta section of the Microsoft Graph online reference, you can find that in the Sites and Lists section, the taxonomy under preview section here, you can see, we have documentation about how to consume the store the term groups, the term sets, and the terms.
And let’s start playing with the term store that I have in my developer tenant. Right here, you can see, I have a bunch of groups. For example, I have this group with a term set made of products and my hierarchy of terms right here. So I want to play with this one using the graph Explorer. So first of all, I will have to switch to the beta endpoint. And from there I can access the term store and point to access the whole term store. Then within the term store. I can access the target group that I want to use so I can get the whole list of groups simply using the slash groups query. And then I can search for that one, which is precisely this one. So let me get the ID. And by using the well-known syntax of Microsoft Graph, I can easily access that specific term group.
In the term group, of course, I have a bunch of term sets. So let me access the collection of sets. And as you can see here, I have just one set, which is the products set, and I can access that one directly providing the id as like as before. So slash sets slash the ID of my set. And here I have the whole term set. The term set is made of terms, which are children objects. So for example, in order to access them, I can simply say slash children. And I will be able to see all of the children of my term set. And if, for example, I want to access one specific item, like let’s say this one, the Office 365 one, or the .NET consulting one, either way, I can get this ID and I will simply need to say that in my target term set, I want to access a specific term in the collection of terms specifying the ID of the target term.
And as you can see, I can get back the main information about the term, including when it was created, modified what the labels are, what the descriptions are, and so I have a bunch of useful information about the term. Something that is really interesting to know is also that if you go back to the admin center, we can see that. For example, in the PMP terms sets, I have the term group, which has a unique idea, and I can copy this value just for the sake of showing you something interesting. I can see that for the term set, I have a unique ID as well. And for the terms under user settings, I still have a unique identifier. So I can easily play with the URLs that I have in Microsoft Graph. And I can, for example, use the unique ID of the term group like I’m doing right now, the one that I’ve got from the UI of the term store to get access to that one, meaning that the ID that we see here is precisely the one that we have from the SharePoint online point of view.
And of course, I can switch to the term set for which I copied the unique ID right here, and I can get access straight to the target term based on the unique ID of the target term simply saying slash terms and providing the ID that I copied from the admin UI of SharePoint online. So you can easily access the content of the term store using the Microsoft Graph, beta endpoint. And hopefully, soon it will become available in the v1 endpoint so that you can use it in production. Cool. So the taxonomy APIs for SharePoint Online is really, really cool, and useful, and we can finally use Microsoft Graph to access the taxonomy SharePoint Online. I hope you found it interesting, the content of this session, and I’m looking forward to seeing you next week. Thank you!