Get value from taxonomy field

1k Views Asked by At

Trying to get the selected value from a taxonomy field in sharepoint online using CSOM. But when getting the taxonomyfieldvalue it is null, why?

        if (listitem.FieldValues.ContainsKey("Division")) // Returns true
        {
            TaxonomyFieldValue taxField = listitem["Division"] as TaxonomyFieldValue; // returns null !!
            pi.Division = taxField.Label;
        }
1

There are 1 best solutions below

1
On

you need to get values as below:

TaxonomyFieldValueCollection Test = (list.Items[0]["Field Name"] as TaxonomyFieldValueCollection); var valuesList = (from v in Test select v.Label).ToList();