DEV Community

Miguel Isidoro
Miguel Isidoro

Posted on • Originally published at blogit.create.pt on

Fixing the “The given key was not present in the dictionary” navigation error in a SharePoint 2016 farm

The post Fixing the “The given key was not present in the dictionary” navigation error in a SharePoint 2016 farm appeared first on Blog IT.

Hello,

Today, after migrating a SharePoint 2010 farm to SharePoint 2016, I suddenly caught an error with the current navigation in a SharePoint Publishing site. The site collection contains three main sub sites. For two of them, SharePoint navigation worked perfectly fine but for the other one, the navigation was not being shown.

The Problem

To try to find out the problem in the problematic sub site, I navigated to the Navigation settings page and caught the following error:

_ The given key was not present in the dictionary. Stack Trace: at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary2.get_Item(TKey key) at Microsoft.SharePoint.Publishing.CachedArea.CreateResultSetFromSuperUserAndSuperReader(StringCollection superReaderItemIDs, StringCollection superUserItemIDs, Dictionary2 cachedObjects, SPWeb contextWeb, SPQuery query, List1 fieldrefs, ICachedObjectFactory objectFactory) at Microsoft.SharePoint.Publishing.CachedArea.GetChildForListByQuery(String listName, SPQuery query, SPWeb contextWeb, Boolean onlyPopulateCache, List1& itemsFetched, Boolean skipIfThrottled) at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.FetchDynamicItems(PublishingWeb pubWeb, NodeTypes includedTypes, Boolean& websFetched, Boolean& pagesFetched) at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.PopulateNavigationChildrenInner(NodeTypes includedTypes) at Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode.PopulateNavigationChildren(NodeTypes includedTypes) at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes, NodeTypes includedHiddenTypes, Boolean trimmingEnabled, OrderingMethod ordering, AutomaticSortingMethod method, Boolean ascending, Int32 lcid) at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedTypes, NodeTypes includedHiddenTypes, OrderingMethod ordering, AutomaticSortingMethod method, Boolean ascending, Int32 lcid) at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode.GetNavigationChildren(NodeTypes includedHiddenTypes) at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.GetChildNodes(PortalSiteMapNode node, NodeTypes includedHiddenTypes)_

The Solution

To solve the problem, all I had to do was reactivating the “SharePoint Server Publishing” Site Feature (not the corresponding Site Collection feature) on the problematic sub site:

After reactivating the feature, the navigation started to work as expected.

NOTE: This solution should also be applicable to other versions of SharePoint Server, including SharePoint 2019. To learn more about all the upcoming features in SharePoint 2019, click here.

Hope this helps someone!

If you want to learn more about installing a SharePoint 2016 farm in a completely automated way using a PowerShell solution called AutoSPInstaller, click here and here.

Happy SharePointing!

The post Fixing the “The given key was not present in the dictionary” navigation error in a SharePoint 2016 farm appeared first on Blog IT.

Latest comments (0)