Get Taxonomy field value programmatically
13/07/2017 13:20
public static string GetTaxonomyFieldValues(SPListItem item, string fieldName)
{
var values = string.Empty;
if (TryGetFieldFromItem(item, fieldName) != null && item[fieldName] != null)
{
var taxonomyValueCollection = item[fieldName] as TaxonomyFieldValueCollection;
foreach (var val in taxonomyValueCollection)
{
values += val.Label + "; ";
}
}
return values;
} public static string GetTaxonomyFieldValues(SPListItem item, string fieldName)
{
var values = string.Empty;
if (TryGetFieldFromItem(item, fieldName) != null && item[fieldName] != null)
{
var taxonomyValueCollection = item[fieldName] as TaxonomyFieldValueCollection;
foreach (var val in taxonomyValueCollection)
{
values += val.Label + "; ";
}
}
return values;
}