3

Using the following code I should be able to access the Taxonomy Term Stores:

$site = new-object Microsoft.SharePoint.SPSite("http://localhost")
$session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)
$session.TermStores.Count

Yet the TermStore count is always 0. I know I have Term Stores and Term Groups and Terms because I'm able to tag items using the terms and view them in the Term Store Management Tool. For the SPSite I have tried localhost, the actual computer name, and even the Central Admin site.

Based on my research this shouldn't be that difficult.

http://msdn.microsoft.com/en-us/library/ee574969.aspx

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.taxonomy.taxonomysession.aspx

http://geeklit.blogspot.com/2009/12/using-sharepoint-term-stores.html

http://davidfrette.wordpress.com/2010/03/31/million-terms

Can you please spot what I'm doing wrong?

6

My Managed Metadata Application Proxy was not a part of the default proxy group. After running the following command $session.TermStores.Count now returns 1! Yay!

Set-SPMetadataServiceApplicationProxy -Identity "Metadata Service Application Proxy" -DefaultProxyGroup
  • Please note, the comments here (regarding Application Proxy and Permissions) worked for me only after I rebooted my machine. – metaomniliquant Mar 6 '12 at 20:36
2

The account you are running powershell may not have permission - you will notice that the session lists the service as offline. Check the Administrators for Metadata Service Application and also check Connection Permissions for Metadata Service Application (which is what fixed it for me).

0

If you look at the second MSDN link you listed, you'll see that the example pulls the session's TermsStores object into a TermStoreCollection and checks the count from there. I wonder if that would solve your problem...

  • That's a good point. Unfortunately getting a reference to the TermStoreCollection still results in 0 entries. $site = new-object Microsoft.SharePoint.SPSite("localhost") $session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site) $stores = $session.TermStores $stores.count 0 – Corbett Jul 19 '10 at 12:41
  • This guy is having the same trouble: go4answers.com/Example/…. What URL does the TaxonomySession's site need to be? Central Admin? – Corbett Jul 19 '10 at 16:33

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.