Pregunta

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.

¿Fue útil?

Solución

You need to cast it as TaxonomyFieldValue.

Check the sample implementation:

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

var label = taxFieldValue.Label;
Licenciado bajo: CC-BY-SA con atribución
scroll top