How to update TaxonomyField sharepoint 2013
the most simple solution, and occasionally the only working one, is to find the Term itself and send it and let SP to handle everything else, and the code is much shorter
this is the code for updating the field
Term ItemTypeTerm = GetTermByName();
if (ItemTypeTerm != null)
{
TaxonomyField ItemTypeField =
(TaxonomyField)f.Fields.GetFieldByInternalName("CbsMMDItemType");
ItemTypeField.SetFieldValue(field, ItemTypeTerm);
}
this is the code for updating the field
Term ItemTypeTerm = GetTermByName();
if (ItemTypeTerm != null)
{
TaxonomyField ItemTypeField =
(TaxonomyField)f.Fields.GetFieldByInternalName("CbsMMDItemType");
ItemTypeField.SetFieldValue(field, ItemTypeTerm);
}
Comments
Post a Comment