SharePoint Online: Hide Search Box In the Top Navigation Suite bar
Requirement: Hide Search Box in the Top Navigation Suite bar in SharePoint Online
How to Remove Search Box from Top Navigation Suite bar?
Search box in SharePoint Online top navigation suite bar can be hidden with this PowerShell script:
How to Remove Search Box from Top Navigation Suite bar?
Search box in SharePoint Online top navigation suite bar can be hidden with this PowerShell script:
#Set Parameters $SiteURL = "https://crescentintranet.sharepoint.com/sites/Marketing" #Get Credentials to connect $Cred = Get-Credential Try { #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) #Get Web object $Web = $Ctx.Web $Ctx.Load($Web) $Ctx.ExecuteQuery() #Disable search in navigation bar $Web.SearchBoxInNavBar = 3 $web.Update() $Ctx.ExecuteQuery() } Catch { write-host -f Red "Error:" $_.Exception.Message }SearchBoxInNavBar enumeration values:
- Inherit = 0
- AllPages = 1
- ModernOnly = 2
- Hidden = 3
#Set Parameters $SiteURL = "https://crescentintranet.sharepoint.com/sites/Marketing" #Connect to SharePoint Online site Connect-PnPOnline -Url $SiteURL -UseWebLogin #Hide Searchbox in Navigation bar Set-PnPSearchSettings -SearchBoxInNavBar Hidden -Scope Web -ForceThis hides the search box from top navigation bar of the SharePoint Online site in few minutes. To Enable the search box back in Navigation bar, use:
Set-PnPSearchSettings -SearchBoxInNavBar ModernOnly -Scope WebAlso, you can set the search box visibility at site collection level by changing the scope parameter from "Web" to "Site"
No comments:
Please Login and comment to get your questions answered!