I has a ListItem with TaxonomyField which has some value in it (some term of course). This TaxonomyField is single value only. So now I want to set it to empty, just as it was from the beginning, but I can't find the way to do it. What I has tried so far:

listItem.ParseAndSetFieldValue(taxField.InternalName, String.Empty);

It doesn't throw any exception on ClientContext.Update(), but field value for listItems stays unchanged.

taxField.SetFieldValueByValue(listItem, new TaxonomyFieldValue());

This gives me "The method or operation is not implemented." Exception


This also runs without exceptions, but value stays the same. BTW do not use such approach, use ParseAndSetFieldValue instead.

So could anyone suggest something that would done a trick? Thanks in advance!


Here is solution:

taxField.ValidateSetValue(listItem, null);
  • Thanks, there are complicated solutions to same problem out there but this one is neat! – Ashish Patel Jan 12 '15 at 3:52

This works in SharePoint online Powershell as well. This code clears the metadata field.

$companyField = $doclib.Fields.GetByInternalNameOrTitle($docLibCompanyIntName)

$txFieldCompany = [Microsoft.SharePoint.Client.ClientContext].GetMethod("CastTo").MakeGenericMethod([Microsoft.SharePoint.Client.Taxonomy.TaxonomyField]).Invoke($doclib.Context, $companyField)             
$txFieldCompany.ValidateSetValue($item, $null)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.