SharePoint DefaultSiteCollectionTermStore is null

Hi,

In my previous blog(Add Metadata Taxonomy Custom Field using Visual Studio), I have explained how we can add custom metadata taxonomy custom field. In the feature code we have to write code to bind the field with the taxonomy term set.

It can be one business requirement to get the taxonomy session for the current site. We all know there is a dll provided by Microsoft named "Microsoft.SharePoint.Taxonomy" found under ISAP folder. Using this Dll we can get access to current metadata service and default metadata term store by using the following code:

var session = new TaxonomySession(<object of SPSite>);

var termStore = session.DefaultSiteCollectionTermStore;

I just used this code but unfortunately this object returns me null :).

Then after spending few hours I found that there is a configuration which allow us to behave term store as default term store.

Follow the below steps to resolve this:

1) Navigate to "Central Administrator > Application Management"

2) Search for "Manage service applications" which will open the list of all services configured on farm.

3) Click on instance of "Managed Metadata Service". DONOT click on link just click on the service row just to select this service.

4) Now go to ribbon and click on "Properties"

DefaultTermStore_1

5) Make sure you have selected the options below three options:

  • Push-down Content Type Publishing updates from the Content Type Gallery to sub-sites and lists using the content type.

  • This service application is the default storage location for Keywords.

  • This service application is the default storage location for column specific term sets.


DefaultTermStore_2

6) Now "OK" button, the DefaultSiteCollectionTermStore was filled and ready for further use.

Thanks for your time :)

Comments

Post a Comment

Popular posts from this blog

Hide Ribbon on SharePoint 2013 using CSS

Get Comment Count in SharePoint

Configure external site as content sources in sharepoint search