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?