Domanda

I am working on building a server-side event receiver for SharePoint on-premises 2013. now I have a single value managed metadata column named "OrderCustomerName", and I want to get the term Label, as currently if I do the following:-

 var ccc = currentItem["OrderCustomerName"].ToString();

I will get value such as "customer ABC|[asdasdasdasdaspdasdas]", now I do not want to rely on doing substring to extract the Label value (customer ABC), rather I am trying to access the Label property for my managed metadata column.

È stato utile?

Soluzione

You need to cast it as TaxonomyFieldValue.

Check the sample implementation:

TaxonomyFieldValue taxFieldValue = currentItem["OrderCustomerName"] as TaxonomyFieldValue;

var label = taxFieldValue.Label;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top