Learn how to change the behaviour of the search bar on your SharePoint site.
I had a case where an entire Intranet was build on a Teams site, and the default search was Search this site
The users wanted to use the search bar to search for colleagues (I know, there are many other ways you can do this), but users/colleagues where not shown when searching within a site (you have to click organization after you have searched, which is not very intuitive)
I don’t think you should change the standard behaviour of SharePoint, but for this blog post, it’s a good introduction to what you can do with PNP-PowerShell cmdlets.
First you need to install PNP.PowerShell, and note, it needs installation to be done using PowerShell version 7
After installation you can now connect to your SharePoint site using this command
connect-PnPOnline https://tenant.sharepoint.com/sites/sitename -interactive
Login with your credentials. PowerShell will not give you any feedback, but if you don’t get any errors, you are connected to your site.
We are going to use the cmdlet Set-PnPSearchSettings, which has the options to change the search to
- Site
- Hub
- Tenant
Use the following command
Set-PnPSearchSettings -SearchScope Tenant
Go to your page and hit F5 and see how your page now says Search in SharePoint
You can change your site back to the standard search again using this command
Set-PnPSearchSettings -SearchScope Site
You can just close down PowerShell, to disconnect from your site or use the command Disconnect-PNPOnline
This was a short introduction to PNP.PowerShell -> but be careful, it is really powerful, so always try first on a test site, and understand what you are doing :)
There are many cmdlets, and I will try to cover the ones that are more low-code, in this blog