SharePoint Online: Change Header Layout, Site Logo, Background using PowerShell

Requirement: Change Header layout, Site Logo and Background settings in SharePoint Online.

How to Set Header layout, Site Logo and Background in SharePoint Online?
To change the header settings in SharePoint Online,
  • Click on "Settings" gear icon >> Click on "Change the look" from site settings menu.
    sharepoint online header logo
  • Click on "Header"
    sharepoint online compact header layout
  • Set the header layout, site logo and header background.
    header background color
  • Click on "Save" to commit your changes.

PowerShell to Set Header layout, Site Logo and Background:
Lets change the SharePoint Online header layout, header background color and header logo using PowerShell.
#Set Variables
$SiteURL = "https://crescent.sharepoint.com/sites/credit"
$LogoURL= "https://crescent.sharepoint.com/sites/credit/SiteAssets/logo.jpg"
  
#Connect to PNP Online
Connect-PnPOnline -Url $SiteURL -UseWebLogin
 
#Get the Web
$Web = Get-PnPWeb

#Set Header Options
$Web.HeaderLayout = "Standard"   # Standard, Compact
$Web.HeaderEmphasis = "None"  # None, Neutral, Soft, Strong
$Web.SiteLogoUrl = $LogoURL
$Web.Update()
Invoke-PnPQuery

Please note, on group connected modern sites, changing the logo is bit different. Refer How to Change Site Logo in SharePoint Online?

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.