Just like I can go to Central Administration > Application Management > Manage Service Applications > Managed Metadata Service and see the list of existing terms under the Keywords termset I'd like to do this programatically in C#.

So what I need to do is access somekind of Managed Metadata Service API, open the Keywords termset (which is the default termset for Entreprise Keywords) and then get a list of all the existing keywords that are applied to at least one document. For each term I'd like to know to which document is applied so then I can run some process to know which terms are most frequently used and which are most infrequently used.

Forgot to mention this is for SharePoint 2010 Server.


You will need to reference the Microsoft.SharePoint.Taxonomy assembly. Then you can open a Taxonomy Session and do what you need to do.

var site = SPContext.Current.Site;
var taxonomySession = new TaxonomySession(site);
var termSet = taxonomySession.DefaultKeywordsTermStore.KeywordsTermSet;


MSDN has this documented in detail: http://msdn.microsoft.com/en-us/library/ee587369(v=office.14).aspx

  • Yes, I've already done that... but once I have a Term I can't find how to get the documents that have this term as enterprise keyword. I'm thinking this is not possible from these Taxonomy classes. – empz Apr 9 '13 at 23:32
  • You are correct. From this side, there are no records of when the terms are used. You would need to iterate through every SPList of every SPWeb of every SPSite of every SPWebApplication to look for metadata fields that contain your values. – John Chapman Apr 10 '13 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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