SharePoint Online: Remove a Custom Theme using PowerShell
Requirement: Remove a custom theme in SharePoint Online.
Remove a Theme in SharePoint Online Using PowerShell:
We can remove a custom theme from SharePoint Online tenant using Remove-SPOTheme cmdlet
SharePoint Online: PowerShell to Delete a Theme
We can also use PnP PowerShell to remove a theme in SharePoint Online.
Remove a Theme in SharePoint Online Using PowerShell:
We can remove a custom theme from SharePoint Online tenant using Remove-SPOTheme cmdlet
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking $TenantAdminURL = "https://crescent-admin.sharepoint.com" $ThemeName = "Corporate Theme" #Connect-SPOService -Url $TenantAdminURL -Credential (Get-Credential) #Get the custom theme to delete $CustomTheme = Get-SPOTheme | Where {$_.Name -eq $ThemeName } If($CustomTheme -ne $null) { #Delete theme Remove-SPOTheme -Identity $ThemeName Write-Host "Theme '$ThemeName' Removed Successfully!" -f Green } Else { Write-Host "Theme '$ThemeName' doesn't exist!" -f Yellow }
SharePoint Online: PowerShell to Delete a Theme
We can also use 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 GreenIf 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.
No comments:
Please Login and comment to get your questions answered!