Question

Does anyone have any idea on how I can fix the navigation? I tried to go into Site Actions-->Site Settings --> Navigation but that page is not loading.

I already tried the Enable/Disable publishing feature (using powershel), Designer, but so far I was not able to make it work.

enter image description here

I will reward anyone that helps me find the answer with a bounty and 50 points as soon as I can get the bounty started.

Thank You for reading

***********MORE INFO**************** This is a SharePoint 2010

Ran this PowerShell script and was able to get to the navigation page under /HR I don't mind to rebuild the top navigation if needed:

# get the site collection
$spSite = Get-SPSite -Identity "http://intranet"
# loop through all the webs in the site collection
foreach ($spWeb in $spSite.AllWebs)
{
    # check if root web as this one doesn't obviously inherit
    if (!$spWeb.IsRootWeb)
{
    if($spWeb.URL -eq "http://intranet/HR"){

        # grab a Navigation object
        $spWebNavigation = $spWeb.Navigation
        # change to true
        $spWebNavigation.UseShared = $false
        $spWeb.URL

     }
}
    # cleanup
    $spWeb.Dispose()
}
# cleanup
$spSite.Dispose()

Was it helpful?

Solution

This error seems to be caused by a bug in the August 2012 CU (see An Unexpected Error..., also SharePoint 2010 Naviagtion error...), which causes duplicate nodes to be created in the navigation tree.

You can use the following PowerShell script to fix this if you supply the path to the page affected and the full URL of the node you added when it broke:

$snapin = Get-PSSnapIn | where-object { $_.Name -eq 'Microsoft.SharePoint.PowerShell' }
if ($snapin -eq $null)
{
  Add-PSSnapin Microsoft.SharePoint.PowerShell
  Write-Host "SharePoint Snapin Loaded"
}

$web = Get-SPWeb http://server:port/path/to/web
$pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
$navNodes = $pubWeb.Navigation.CurrentNavigationNodes

$brokenNodes = $navNodes | where { $_.Url -eq "http://server:port/full/url/to/broken/link" }

for($i = $brokenNodes.Count - 1; $i -ge 0; $i--)
{
  Write-Host "Deleting " $brokenNodes[$i].Title " " $brokenNodes[$i].ID
  $brokenNodes[$i].Delete()
}

$web.Dispose()

Hope this helps.

Edit

A note on the code in your edit: Why don't you just get the SPWeb object that you want to work with directly?

$spWeb = Get-SPWeb -Identity "http://intranet/HR"
$spWebNavigation = $spWeb.Navigation
$spWebNavigation.UseShared = $false
$spWeb.URL

$spWeb.Dispose()

OTHER TIPS

I had the same symptoms but a different cause. It turns out you can deploy an Elements.xml file that re-defines an existing, OOB site column. Somebody created a element using the GUID {9da97a8a-1da5-4a77-98d3-4bc10456e700} which is the ID for the built-in field with the internal name Comments, used in the Publishing content types for check-in comments. In our case, that field got the new internal name "Details" (and was published out through content type publishing!). Every new site collection had a mis-named Comments field and so had a broken top nav bar (turn logging up to verbose and you'll see that SP queries the Pages library and looks for the Comments field). This also prevented me from restoring a (publishing-enabled) site collection that had been exported using stsadm -o export because of a 'duplicate field name' on that GUID in the target site collection. It's like Sharepoint no longer sees the column as a built-in field.

Beware! You have to re-create the site collections to fix the re-named built-in field.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top