[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1463
  • Last Modified:

SP2010: C#, SharePoint list and managed metadata.

Hello. I wrote a simple class that iterates through any given list. Nice but what about managed metadata? Is it possible to know if the field in question is a taxonomy field? Apparently there is no field type for managed metadata (http://sharepoint.model-xtractor.com/sharepoint-2010-field-types-field-controls/). Edit: Taxonomy fields are Lookup columns. Seem that all I need to to is to get all values from this field.
0
tolppa
Asked:
tolppa
1 Solution
 
colly92002Commented:
Include a reference to: Microsoft.Sharepoint.Taxonomy.dll

Add the following using directive:
using TaxonomyField = Microsoft.SharePoint.Taxonomy;

Open in new window


You can now use this on your fields, eg:

 SPList myList= currentWeb.Lists["My List Name"];

TaxonomyField myTaxonomyField= myList.Fields["My field name"] as TaxonomyField;
if(myTaxonomyField == null)
{//Not a taxonomy field
}
else
{// Deal with the taxonomy field here
}

Open in new window

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now