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 - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

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