0

Trying to access the Taxonomy in a SP 2013 solution (VS2012, C#), but always get a access denied (unauthorized access) on the TaxonomySession object if I am logged in as a "normal" user. If I am logged in as an termstore administrator everything works fine.

I even tried to clear the httpContext (http://www.communardo.de/home/techblog/2011/10/18/sharepoint-2010-der-termstore-und-der-priviligierte-nutzer/), but no success. The SPSite object for the TaxonomySession is even created as the SystemAccount.

All I need is read access for the solution.... cant't get it, what am I doing wrong?

SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            using (SPSite thisSite = new SPSite(guid, SPUserToken.SystemAccount))
            {
                try
                {                        
                    TaxonomySession taxonomySession = new TaxonomySession(thisSite, true);                        
                    TermStore termStore = taxonomySession.DefaultKeywordsTermStore;

                    Group navGroup = termStore.Groups[group];
                    TermSet termSet = navGroup.TermSets[termset];

                    _termset = termSet;
                    termCollection = termSet.Terms;
                    _termCollection = termCollection;

                    NavigationTermSet navigationTermSet = NavigationTermSet.GetAsResolvedByWeb(termSet, thisSite.RootWeb, StandardNavigationProviderNames.GlobalNavigationTaxonomyProvider);
                    _navigationTermSet = navigationTermSet;

                }
                catch (Exception)
                {
                }//try

            }//using            
        });//SPSecurity

1 Answer 1

1

Add the Application Pool account as term Store administrator.enter image description here

For check your application pool account´s use the following command:

Get-SPServiceApplicationPool

1
  • Thanks. Unfortunately this did not fix my problem. Still getting an unauthorized message...
    – mr.purzel
    Commented Jul 28, 2015 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.