1

I tried to access the Default Termstore for a Sitecollection in order to create Groups and Termsets from a Farmsolution.

While accessing all existing MMS works perfect with:

TaxonomySession session = new TaxonomySession(web.Site);

sesstion.Termstores.Count

I receive the correct amount (first 3, afterwards I tried to get other results with attaching just one MMS to the desired Sitecollection).

But every time I try to access the default Store with:

TermStore defaultTermStore = session.DefaultSiteCollectionTermStore;

all I get is "null" (used this part of the code example from MSDN)

The CA of my Sharepoint tells me that there really IS an default MMS for the desired Web-App. Default Termstore

What am I missing ?

EDIT: As L Sconyers pointed out, I need to set the default Proxy. Then I can find this Store in my code.

But my problem still exists. I have about 7 different TermStores in the Farm and each App has 1-3 of them assigned. Each App has one default Store defined in the wep applications / service connections (used for auto tagging and search applications). Is there any way to find this default Store for the App in which my feature is going to be activated?

2

That default setting is the default for the application group. To get the DefaultSiteCollectionTermStore you need to change a setting on the Managed metadata service Proxy. I think it's "This Service Application is the default location for column specific term sets". You'll probably want to check both settings.

  • What else does this change? And is it still possible to have different Default-Stores for each Web-App (like done in the manage web applications / service connections) ? I can do this setting on my DEV instance, but I don`t want to do this to the PROD system without knowing what exactly that changes. – Leviani Sep 9 '13 at 6:38
  • I'm not sure what else it changes. You'll have to go trial and error. – lestersconyers Sep 13 '13 at 18:00
0

The setting is specified on the metadata application proxy connection.

If multiple proxies associated with the SPWebApplication object of the SPSite site are marked as the default keyword TermStore, then the property will return a null reference (nothing in Visual Basic) because there should only be a single default.

Reference:

TaxonomySession.DefaultSiteCollectionTermStore Property

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.