How do you get a TaxonomyField object from the Managed Property Title? Does anyone know a good article/tutorial on programatically working with taxonomies in Sharepoint 2010?
Tell me more
×
SharePoint Stack Exchange is a question and answer site for
SharePoint enthusiasts. It's 100% free, no registration required.
|
Creating a TaxonomyField goes something like this:
If you're going to work with Managed Metadata the Andrew Connell's article series is almost a must. To get a reference to the field just use:
To set the value in a list item ALWAY use one of the TaxonomyField.SetFieldValue overloads, NEVER just use item["My Tag Field"] = xxx. The TaxonomyField is implemented as a lookup into a hidden list and the term needs to be copied into this list when first used. If you need to get an exising field based on TermSet name the you have to loop through the fields to find it:
|
|||||||||
|
|
Try this:
|
||||
|
|