SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having a hard time trying fo figure this one out. I can only use Microsoft.Sharepoint.Client for this. I'am working with Sharepoint 2013.

I need to list all Fields (Metadata) For a certain content type that are actually Manage Metadata TermSet fields. I can already get the ContentType and access its Fields. Once there I can find all the TermSet Fields base on Field.TypeAsString just like this :

if (field.TypeAsString == "TaxonomyFieldType" || field.TypeAsString == "TaxonomyFieldTypeMulti")

So What I'm wondering now is How could I get the proper TermStore in order to get the TermSet ? I know I need the TermStore Id, but I didn't find it anywhere in the Field's properties. I'm currently looking at MSDN but didn't find anything yet.

Thanks for any information you can provide!

share|improve this question
up vote 2 down vote accepted

I think this will give you what you are looking for...

// get the TaxonomyField from the Site Columns in the sitecollectionTaxonomyField 
field = (TaxonomyField)site.RootWeb.Fields[TAXONOMYFIELDID]; 
// get the Term Store ID from the field
Guid termStoreId = field.SspId; 
// Open a taxonomysession and get the correct termstoreTaxonomy
Session session = new TaxonomySession(site);
TermStore termStore = session.TermStores[termStoreId];

Let me know if this doesn't solve your problem.

share|improve this answer
Thanks for the answer, it did point me in the right direction! Microsoft.SharePoint.Client.Field does not have any "SspId" property BUT I finally found it in the "SchemaXml" property along with the TermSetId. With those I can now get the "TermStore -> TermSet -> Term -> Label" structure I need. Just a bit of code to do and I think I should be good! Thanks again – Alex Feb 20 '13 at 21:46
Cool. Glad you got it figured out! – Darrin Brandon Feb 21 '13 at 2:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.