Provision managed metadata groups and term sets in office 365 using Powershell + CSOM with predefined GUIDs


Posted on August 24th, 2014

In this post you will learn how to provision managed metadata groups and term sets in office 365 using Powershell + CSOM with with predefined GUIDs. Intention behind this is, these Group and Term set ids need to be fixed when you want to deploy the manage metadata fields across the tenants(Dev/Test/UAT/Prod) in office 365, but when you create group and term sets by administrator it will generate unique ids which is not in our control. We will use these group Id and Term set while provisioning the manage metadata fields in other post.

Prerequisites:

I have created a folder called scripts and placed the required SharePoint client dlls.

Below are the list of dlls i need for execution of script.

  • Microsoft.SharePoint.Client.dll
  • Microsoft.SharePoint.Client.Runtime.dll
  • Microsoft.Online.SharePoint.Client.Tenant.dll
  • Microsoft.SharePoint.Client.Taxonomy.dll

I created an xml file where i can specify the Group and Term sets with predefined GUIDs. You can see the structure of the xml file below.

Below one is final folder structure where i have all the dlls, xml file and powershell script which need to be run to create the manage metadata groups, term sets and terms.

Powershell script:

The below scripts creates groups, term sets and terms based on details specified in the xml. It also validate if the groups, term sets and terms specified in the xml is already exist. If they are exist it will notify the user running the script.


Conclusion:

In this post you have learned how to provision managed metadata groups and termsets in office 365 using Powershell + CSOM with with predefined GUIDs.


› Provision managed metadata groups and termsets in office 365 using Powershell

About Author

Devendra Velegandla is a four-time recipient of Microsoft's Most Valuable Professional (MVP) award (2014-2017) for Office Servers and Services MVP and  SharePoint Server.He received the MCC award for his contributions in Microsoft MSDN/TechNet forums.He loves sharing articles, videos and tutorial on SharePoint and Office 365.


If you found this post helpful, please share with your friends!!


Join 6,000 subscribers and receive instant access to

Devendra's Library of Resources for SharePoint Developers