0

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;
        }
Phrone
  • 21
  • 4

1 Answers1

1

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();

  • Thanks, but I have already tried to use TaxonomyFieldValueCollection instead of TaxonomyFieldValue but it also returns null. – Phrone Jun 14 '21 at 15:11