Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We have two version of our sharepoint instance on a different servers. One is development and the other is production. The root node of the breadcrumb on the dev version, in every site/site collection but the home page, is not correct though, it points to our production server:

Top level > Site > Site

The "Top level" link above points to http://intranet but should point to http://intranetdev

I need to change this so I or someone else doesn't accidentally click on the link and make changes to our production server, thinking they were on the dev server.

Any help is appreciated.

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

You can iterate through the links and fix the URLs of the nodes in the collection.

Something like this PowerShell script I just whipped up for you:

$site = Get-SPSite -Identity "http://intranetdev"

foreach ($web in $site.AllWebs)
{
    if (!$web.Navigation.UseShared)
    {
        $topNav = $web.Navigation.TopNavigationBar

        foreach ($node in $topNav)
        {
            if ($node.Url == "http://intranet")
            {
                $node.Url = "http://intranetdev"
            }
        }
    }

    $web.Dispose()
}

$site.Dispose()

You may need to implement more complex logic to verify the URL depending on your specific instance, but this should be a solid framework.

Validate that the .Url property is indeed set as "http://intranet"... Most nodes are relative URLs, though the behavior you're seeing implies the nodes in question were added with the absolute URL.

Perhaps iteration is not the most efficient, but this is one run code.

share|improve this answer
    
Thanks! If it works it works. It is only a dev instance anyway. I thought maybe it was a setting in central admin but I looked everywhere. –  steveareeno Mar 14 '13 at 14:41
    
You might want to fiddle with the script and use a relative URL instead of the absolute "intranetdev" URL to do it the "right" way. –  RJ Cuthbertson Mar 14 '13 at 15:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.