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!).
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