Delete custom color themes from SharePoint
Summary
Have you been creating a lot of beautiful themes lately and testing them in your dev tenant, but don't want to keep them anymore? If yes, then this PowerShell script is for you.
# SharePoint online admin center URL
$SPOAdmminSite = "https://contoso-admin.sharepoint.com"
$themesToKeep = "Contoso Explorers", "Multicolored theme"
# Connect to SharePoint online admin center
Connect-PnPOnline -Url $SPOAdmminSite -Interactive
# Get all themes from the current tenant
$themes = Get-PnPTenantTheme
$themes = $themes | where {-not ($themesToKeep -contains $_.name)}
$themes | Format-Table name
if ($themes.Count -eq 0) { break }
Read-Host -Prompt "Press Enter to start deleting $($themes.Count) themes (CTRL + C to exit)"
$progress = 0
$total = $themes.Count
foreach ($theme in $themes)
{
$progress++
write-host $progress / $total":" $theme.name
# Delete custom color themes from SharePoint
Remove-PnPTenantTheme -Identity "$($theme.name)"
}
# Disconnect SharePoint online connection
Disconnect-PnPOnline
Check out the PnP PowerShell to learn more at: https://aka.ms/pnp/powershell
The way you login into PnP PowerShell has changed please read PnP Management Shell EntraID app is deleted : what should I do ?
Contributors
Author(s) |
---|
Leon Armston |
Ganesh Sanap |
Disclaimer
THESE SAMPLES ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.