SharePoint Online: Remove a Custom Theme using PowerShell

Requirement: Remove a custom theme in SharePoint Online
sharepoint online remove custom theme powershell

SharePoint Online: PowerShell to Delete a Theme
Here is the PnP PowerShell to remove a theme in SharePoint Online.
#Config Variables
$AdminSiteURL = "https://crescent-Admin.sharepoint.com"
$ThemeName = "Corporate Theme"

#Connect to PnP Online
Connect-PnPOnline -Url $AdminSiteURL -UseWebLogin

#Get the Custom Theme
$Theme = Get-PnPTenantTheme | Where {$_.Name -eq $ThemeName}

If ($Theme.Count -eq 0) 
{ 
    Write-host "The specified Theme '$themeName' doesn't exist!" -ForegroundColor Yellow
    Break; 
}

#Remove the Theme
Remove-PnPTenantTheme -name $Theme.Name
Write-host "Custom Theme '$ThemeName' Removed Successfully!" -ForegroundColor Green
If you remove a custom theme, any site uses the particular theme will not have any effect! They continue to use the colors of the deleted theme until you change it to a new theme.
SharePoint Online: Remove a Custom Theme using PowerShell SharePoint Online: Remove a Custom Theme using PowerShell Reviewed by Salaudeen Rajack on May 30, 2019 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.