SharePoint online: Creating managed metadata column using site script and site design
Hi Friends,
Recently I came across a requirement to create managed metadata column through site script which should be available after creating the site.
I tried different approaches and tried to find many alternatives but no fruitful information found after tried multiple column schema xml I got it working.
Will start with showing the term store.
I have created a sample group ‘Test Group’ and underneath it a term set named as ‘Business Area’ with some sample terms.
Managed metadata column in SharePoint online works same as on premise one. There are actually two columns in the list one column is with of type ‘TaxonomyFieldType’ and other column is created with the with format fieldnameTaxHTField0 of type Note.
The Taxonomy column holds Term name and a lookup with the TaxonomyHiddenList. TaxonomyHiddenList can be found at /Lists/TaxonomyHiddenList/AllItems.aspx this list will hold the details of the terms that are used in any managed metadata column.
Hence for creating managed metadata column through site design we need to create two columns, one of type Note which we need to use while creating actual managed metadata column.
We need multiple GUIDs while creating the metadata column,you need to replace values from your tenant, as follows –
- SspId Taxonomy term store guid
- GroupId Taxonomy term set group guid
- TermSetId Taxonomy term set guid
- TextField Note column guid
Following is the site design JSON file. This include both the columns.( Save content in .json file)
I have created the site design using ‘SharePoint online management shell’
Let’s try now creating new site using the newly created site design.
Looking like we got success with creating new columns.
Let’s add ‘Business Area’ column in document library to test if the column is working or not.
Let’s try uploading new document in library and check if the column is showing the values form term set.
The column provisioned through the site design is working as expected.
Let’s check the TaxonomyHiddenList now.
And if we check by editing item properties you can see same GUIDs we added in JSON file.
Considering 30 verbs limitation (as on date) per site design, this may not be a good solution to spend two verbs for a single managed metadata column.
The purpose of this article is to save some time if anyone have same kind of requirement.
Sharing is caring.
Blog Stats
- 129,971 hits
Archives
- December 2023
- May 2021
- April 2021
- March 2021
- January 2021
- July 2020
- November 2019
- July 2019
- September 2018
- July 2018
- November 2017
- October 2017
- September 2017
- August 2017
- July 2017
- June 2017
- May 2017
- April 2017
- March 2017
- February 2017
- January 2017
- June 2016
- May 2016
- March 2015
- February 2015
- December 2014
- October 2014
- July 2014
- June 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- July 2013
- June 2013
- March 2013
- February 2013
- November 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- April 2011
- February 2011
- February 2010
M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |