SharePoint Online: Change List or Document Library Icon using PowerShell

Problem: Icon for document library is broken in SharePoint Online after migration.

How to Fix Broken Icon for SharePoint Online List or Document Library?

After migrating from SharePoint On-premises to SharePoint Online, we found specific document library icons are broken – These document libraries were provisioned through a custom application and have custom icons! As the related artifacts such as images and CSS were not migrated, list icons were broken (we can’t deploy file system changes to the 16 hive in SharePoint Online!).

change document library icon in sharepoint online

But the good news is: We can change the document library icon using PowerShell!

#Set Parameters
$SiteURL = "https://crescent.sharepoint.com"

#Connect to SharePoint Online site
Connect-PnPOnline -Url $SiteURL -Interactive

#Get the List
$List = Get-PnPList "Documents"

#Update Icon for the list
$List.ImageUrl = "/_layouts/15/images/itdl.png"
$List.Update()
Invoke-PnPQuery

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

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