Introduction
With the introduction of SharePoint V2 REST API for Managed Metadata services, it has become very easy to create a term in term store using REST API. But what if we would like to automate things? In such cases we can use the help of Power Automate. In the automation, we would create a simple custom SharePoint list with only title field, and when a user enters the item in the list we would create a term for that particular title.
Steps to be used to create flow using Power Automate
Step 1 – Select the trigger (when an item is created) We require this flow to trigger when a new item is created in the list, so we select the trigger as “when an item is created”. Once we have selected the trigger we need to select the site collection where the list is present and the list for which we need this trigger to work,
![How To Create Term In Term Store Using Power Automate](https://csharpcorner.azureedge.net/UploadFile/BlogImages/06062020092139AM/1_Trigger.png)
Step 2 – Create variables (Initialize variable) We will create two variables with the step named “Initialize variable” Let us set the name of the variables as mentioned below:
- GroupId
- TermSetId
We will use string as the type of both the variables. We can provide the value as Group Id and TermSet Id. To fetch the Id of group and term set we can navigate to the SharePoint admin center and expand the content service section present in the left navigation and click on Term store. Click on the group under which we need to create the term and copy the “Unique identifier” field value. In the same process for the term set, we can select the term set under which we need to create the term and copy the “Unique identifier” field value.
![How To Create Term In Term Store Using Power Automate](https://csharpcorner.azureedge.net/UploadFile/BlogImages/06062020092139AM/2_Variables.png)
![How To Create Term In Term Store Using Power Automate](https://csharpcorner.azureedge.net/UploadFile/BlogImages/06062020092139AM/4_TermStore.png)
Step 3 – REST API (Send an HTTP request to SharePoint) We will now send the REST API to create the term, for that we will add a step named “Send an HTTP request to SharePoint”. This will allow us to use the SharePoint REST API v2 for Managed Metadata service for creating terms. Site Address – We can select the site address from where we need to post the API.Method – We will Select POST as the method value.
Uri
_api/v2.1/termStore/groups/@{variables('GroupId')}/sets/@{variables('TermSetId')}/children
Note We will use the groupId and TermSetId variables in the URI. Body
{
"labels": [
{
"name": "@{triggerBody()?['Title']}",
"isDefault": true,
"languageTag": "en-US"
}
],
"descriptions": [
{
"description": "@{triggerBody()?['Title']}",
"languageTag": "en-US"
}
]
}
![How To Create Term In Term Store Using Power Automate](https://csharpcorner.azureedge.net/UploadFile/BlogImages/06062020092139AM/3_HttpQuery.png)
Conclusion
Term creation is automated by using flow in Power Automate. This can be helpful as most of the users will not have access to term store but they can create an entry in the list and if the user who has created the flow has proper access to create the term, then the terms get created in Term Store.
About the Author:
I am SharePoint Developer with experience in Front End Technologies like reactjs , jquery , typescript ; backend technologies like javacript with nodejs, C# ; scripting experience with PowerShell scripting
Reference:
Sangani, K. (2020). How To Create Term In Term Store Using Power Automate. Available at: https://www.c-sharpcorner.com/blogs/how-to-create-term-in-term-store-using-power-automate [Accessed: 9th March 2021].
Find more great Power Platform content here.