How i can get the Label for a managed metadata single value column inside my event receiver
-
15-01-2021 - |
Вопрос
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.
Решение
You need to cast it as TaxonomyFieldValue
.
Check the sample implementation:
TaxonomyFieldValue taxFieldValue = currentItem["OrderCustomerName"] as TaxonomyFieldValue;
var label = taxFieldValue.Label;
Не связан с sharepoint.stackexchange