Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Term Set: ArgumentOutOfRangeException if "Available for Tagging" is unchecked.

$
0
0

I'm working on a Managed Navigation user control that expands on the OOTB Managed Navigation. I have a function to get the term set from the term store:
    TermSet getNavigationTerms(SPSite site, string termstore, string groupName, string termset)
        {
            TermSet termSet = null;
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (var elevatedSite = new SPSite(site.ID))
                {
                    TaxonomySession taxonomySession = new TaxonomySession(elevatedSite);
                    TermStore termStore = taxonomySession.TermStores[termstore];
                    Group group = termStore.Groups[groupName];
                   termSet = group.TermSets[termset];
                }
            });
            return termSet;
        }

The problem:

This works fine except if "Available for Tagging" is unchecked on the Term Set. When a user is logged in, the navigation does not display unless the user is a Term Store Administrator. The underlined section returns an ArgumentOutOfRangeException (Specified argument was out of the range of valid values). Oddly enough, it does load correctly for anonymous users. Is there a way I can keep "Available for Tagging" unchecked?

                   

Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>