Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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;

EDIT

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

share|improve this answer
    
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. –  emzero 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
add comment

Your Answer

 
discard

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.