Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top