SharePoint 2010: How to set Taxonomy Field Values programmatically
There are now many blogs and forum posts explaining how to add Taxonomy Fields to a list via the UI, via CAML or programmatically. The end result is a Taxonomy Field linked with a hidden text field, with the hidden text field usually taking the name of the Taxonomy Field appended with ‘TaxHTField0’.
The problem is there are also many posts explaining how to set values in Taxonomy Fields programmatically or how to query for list items using a Taxonomy Field, but they usually leave something out with consequences that are not immediately apparent or use unsupported methods.
The Taxonomy Field ultimately requires 3 values to be set correctly, the WSS ID, the term name, and the term GUID.
The term name and GUID are straight-forward assuming you have pre-populated the term store providing the GUIDs rather than letting them get auto-generated, or alternatively you can lookup the term in the term store and find out the GUID.
The WSS ID however has many confused. When a term is used for the first time in a site collection, the term is also added automatically behind-the-scenes to a hidden site collection list called ‘TaxonomyHiddenList’. This among other things acts as a cache of previously used terms in the site collection. The WSS ID of a term is only unique to a site collection, and is the value of the numeric list item ID in the TaxonomyHiddenList. Read more…
Top Posts
- SharePoint: How to check which Site Template was used to create a site just using a web browser
- SharePoint 2010: PowerShell to Clear the Timer Job Cache
- SharePoint 2010: PowerShell to Wait for WSP Solution Deployment Timer Job to Complete
- SharePoint Online: Adding Term Store Administrators
- SharePoint 2010: List View Threshold Explained
Archive
- June 2019 (1)
- May 2019 (1)
- January 2019 (1)
- October 2018 (1)
- July 2018 (1)
- October 2017 (1)
- May 2017 (1)
- June 2015 (1)
- June 2013 (1)
- May 2013 (2)
- April 2013 (3)
- March 2013 (1)
- February 2013 (1)
- December 2012 (1)
- November 2012 (3)
- October 2012 (3)
- August 2012 (1)
- July 2012 (1)
- June 2012 (1)
- May 2012 (1)
- April 2012 (2)
- March 2012 (5)
- February 2012 (8)
- September 2011 (1)
- July 2011 (2)
- June 2011 (6)
- August 2010 (1)