Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How do I get the terms used in a TaxonomyField?

$
0
0

Hi All,

I have a SharePoint List with a custom managed metadata field. I want to get the terms that are used for a particular item. I can get access to the item through the object model, and can get to the field (which by then the type is actually called a TaxonomyField), but I can't seem to get access to the terms for the field.

I am not looking to get all possible terms for the field. I am trying to get to ONLY the terms that were picked by the user for a particular item.

Field metadata = targetList.Fields.GetByInternalNameOrTitle(listcol[i]);
TaxonomyField fd = context.CastTo<TaxonomyField(metadata);
TaxonomyFieldValue taxonomyFieldValue = new TaxonomyFieldValue(fd);
taxonomyFieldValue.Label.ToString();

But I am getting the below error:

"'Microsoft.SharePoint.Client.Taxonomy.TaxonomyFieldValue' does not contain a constructor that takes 1 arguments".

I read below blogs and did according to that but not working for me:

http://sharepoint.stackexchange.com/questions/78821/unable-to-add-taxonomy-field-value-in-list-item

http://www.c-sharpcorner.com/uploadfile/anavijai/programmatically-set-value-to-the-taxonomy-field-in-sharepoint-2010/

Any solution, as what I am missing?

Thanks in Advance.


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>