Wednesday, December 7, 2011

Navigation errors after SharePoint 2007 upgrade to SharePoint 2010

After an upgrade from SharePoint 2007 to SharePoint 2010 the navigation returned errors instead of menu items. We encountered these issues when the Dutch language pack was installed, because the Pages library has been translated/renamed to “Paginas”.
The solution to this problem is pretty easy, a simple PowerShell script will restore your navigation.

$site = Get-SPSite("http://WebApplicationURL")
foreach ($web in $site.AllWebs)
    Write-Output("web:" + $web.ServerRelativeUrl);
    $pageslistid = $web.AllProperties["__PagesListId"]

    if ([String]::IsNullOrEmpty($pageslistid))
        Write-Output($web.ServerRelativeUrl +" doesn't have a pages list id set - skipping");
        $pageslistguid = new-object System.Guid($pageslistid)
        $pageslist = $web.Lists[$pageslistguid]
        $pagesurl = $pageslist.RootFolder.Url
        $pb = $web.Properties;
        $pb.Add("__PagesListName", $pagesurl);
        Write-Output($web.ServerRelativeUrl +" set pages list to " + $pagesurl);

Microsoft has provided a solution described in KB 2484317

No comments: