WebFldr link and SharePoint 2010

After migrating one of my Web Apps from SharePoint 2007 to SharePoint 2010, I ran into a small issue. In just about every site in every site collection, the users setup links to the Explorer View. Well, SharePoint 2010 doesn’t much care for the WebFldr.aspx link.

I had two options:
Update every link, in every site one at a time.
Use PowerShell to loop around and update the links for me.

Also noticed that when users clicked on these WebFldr.aspx link, the ribbion would get stuck in a Loading state.

What I’m doing with this script:
Define the items we are looing for and replacing.
Open the site collection.
Loop on each site in the collection.
Get the Quick Launch.
Loop on the Headers.
Loop on the Child Node of each Header.
If the Child Node contains our $stupidLink, we then replace that link with the $goodLink, and update it.
Dispose of our connections.

Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

$stupidLink="WebFldr"
$goodLink="AllItems"

$sSiteColl = Get-SPSite  "http://sharepointed.com/SiteCollection/"
foreach($sSite in $sSiteColl.AllWebs)
	{
	 	$site = Get-SPWeb $sSite.Url
		$qlNav = $site.Navigation.QuickLaunch

		foreach($qHeader in $qlNav)
		{
			foreach($ChldNode in $qHeader.Children)
			{
				if ($ChldNode.Url.Contains($stupidLink)) 
				{
					Write-Host $site.Url -BackgroundColor DarkYellow
					Write-Host $ChldNode.URL -BackgroundColor DarkCyan
					$ChldNode.Url = $ChldNode.Url.Replace($stupidLink,$goodLink)
					$ChldNode.Update()
				}
			}
		}
	}
	$sSite.Dispose()
$sSiteColl.Dispose()

This script is also used to update the Quick Launch children nodes in SharePoint.

Leave a Reply

Your email address will not be published. Required fields are marked *