If you’re trying to programmatically remove a taxonomy field value from a taxonomy field, you’ll quickly discover that setting the value to null will throw an error. It turns out you need to explicitly null out each of the values in the TaxonomyFieldValue complex type first, then update your list item’s taxonomy field with the new value, like this:

Guid fieldId = new Guid("{B756F341-D446-4ad7-B435-AA09F46340A3}");   
TaxonomyFieldValue tfv = listItem[fieldId] as TaxonomyFieldValue;
tfc.WssId = 0;
tfc.TermGuid = null;
tfc.Label = null;
TaxonomyField tf = page.Fields[fieldId] as TaxonomyField;
tf.SetFieldValue(listItem, tfv);
About Admin

Owner of Savvy Technical Solutions

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.