Thursday, December 10, 2015

How to Fix a Broken Content and Structure Page Due to Your Custom SharePoint List Icon

Ever used a custom icon for a SharePoint list? It may look good, but I recently ran into a scenario where an icon made a site’s Content and Structure page look funky. I’m well aware that funky is a real technical term, but it’s a great adjective in this situation. Thankfully there's a Powershell script to fix this. I've only run into this scenario once, but it's an interesting one and I wanted to share the resolution.

Here's the aforementioned funkiness.


In the script below, for each list that looks funky or funkay, copy and paste the three lines starting with $customlist and create a new variable (i.e. $anotherlist, $athirdlist). Then update the list name to be the list's display name. The script will then update the icon to be the default list/library icon.

#get params

param([string]$rootWebUrl = "http://yoursite")

#apply SP snapin

$snapin = Get-PsSnapin | where { $_.Name -eq "Microsoft.SharePoint.PowerShell" }

if($snapin -eq $null)


Add-PsSnapin "Microsoft.SharePoint.PowerShell"


#fix list URL

Write-Host "Fixing links list icons..."

$iconPath = "/_layouts/15/images/itlink.png?rev=23"

$web = Get-SPWeb $rootWebUrl

$customList = $web.Lists["List Name"]

$customList.ImageUrl = $iconPath;


$anotherList = $web.Lists["Another List Name"]

$anotherlList.ImageUrl = $iconPath


Write-Host "Done."