Configure modern search results to search all of your organization (rather than the current site)

Kerem Yuceturk

Hey everyone,


We heard from many of you the need to be able to change the scope of your modern search results pages. When you create a new communication site or team site in SharePoint Online today, and type into the search box, you are taken to the modern search results page. This page shows results from your current site by default, and allows you to expand the scope of your search to the hub that the current site is associated with (if there is one), or to the whole organization.


But there is a desire for being able to change the behavior to always search over the whole organization, without needing an additional click, especially if the site in question will be used as a modern landing page for your organization. 

DefaultSearchScope.JPGSearching in a site will show results from that site (Strategy and Planning), with a control to expand the search scope to the hub (Sales) or the whole organization

I'm happy to say that with the latest version of the SharePoint PnP PowerShell extensions, it is possible to run a simple command as the site owner, and make your site use the organization scope by default.


To change this setting:

1. Start PowerShell in administrator mode as you will be installing the PnP extensions.

2. Run the following commands to in this order:

PS C:\WINDOWS\system32> Install-Module SharePointPnPPowerShellOnline
# If you previously had installed this module, you may need to use the "-Force" parameter to install the newer version.
PS C:\WINDOWS\system32> Connect-PnPOnline -Url -UseWebLogin
# this will prompt you to sign into your site. Use the site owner credentials to sign in
PS C:\WINDOWS\system32> $web = Get-PnPWeb PS C:\WINDOWS\system32> $web.SearchScope = 1
# 1 for Tenant, 0 for default behavior
PS C:\WINDOWS\system32> $web.Update() PS C:\WINDOWS\system32> Invoke-PnPQuery

After running these commands, the site will start to show results from the whole organization.OrganizationResults.JPGAfter the change, results from the whole organization are displayed.To go back to the default setting, run the commands again with the value provided to "SearchScope" parameter to 0. 


We will be providing a way to set this setting using the UI later this year as well. 

53 Replies
Hi Kerem,
Will this also be added to the sitescript actions soon? That’s in my opinion more important then having it available through the UI.
Is there a way to change the scope to be just the sites in the hub? This would allow you to set all hub sites to have the same search scope as the root hub site.

Hi @Robert Schouten, not right away, but some of my colleagues are working on adding the ability to set properties and turn on features. Hopefully that will be available later this year.


Hi @Rick DeFoe, we are actually working on making that happen. We hope that will be coming in the next couple of months.

@Robert Schouten, in the meanwhile you could make the site script to start a flow and from that flow call an Azure function that runs the PowerShell script.



@Laura Kokkarinen yes I know that road. At some customers, an Azure environment is not always available. But if it is, it a very valid option! Tnx...

Thank you for adding this feature. Often requested by our customers. Just tried it out and worked directly as I expected.

Optional easy way: Create a Link to your Navigation Bar ->


@Kerem Yuceturk This looks great! I am trying to implement it and run into an issue when trying to connect to the site. We have single sign on enabled via SailPoint and when the browser goes to try and log me in I get a blinking screen and cannot get connected. Any suggestions?

@Kerem Yuceturk It seems that searching trough the REST API, this setting is ignored.


This query for example, searches only in the current sitecollection on a modern communication site:


See also this issue:

@Kerem Yuceturk It seems that searching trough the REST API, this setting is ignored.


This query for example, searches only in the current site collection on a modern communication site:'test'


See also this issue:



Even though the search api of the site is used you still can be able to get tenant wide results. 


When doing a site scoped search we scope by limiting the search in the query template of the query with Path:"UrlToCommunicationSite". And when upscoping this path part of querytemplate is removed.


So you should still be able to get tenant wide results even if the search api of the communicationsite is used to post the query.


Are you only seeing results from your communicationsite after changing the site scope?

@Joe Volk , sorry not familiar with that. My two factor auth works when I use -UseWebLogin. This page has more information about the PnP solution, and may have some discussions that might be helpful:

Hi @Renevdo, This is for the modern search results UI only. It has no effect on REST. You should be able to get to the scope that you want in REST in other ways like  as @Geir-Magnus Pettersen mentioned!

@Kerem Yuceturk 


I noticed that the search box placeholder does not change on hub sites, see screenshots: 


Hub search box: 


All other sites:



Will this be fixed/updated so that the placeholder is consistent across hub and non-hub sites? 

@Kerem Yuceturk 


I follow the directions step by step and i am getting error:

The property 'SearchScope' cannot be found on this object. Verify that the property exists and can be set.


Have the latest version of powershell.

Anyone seen this error?



I'm receiving the same error. I've made sure I'm running PowerShell in Admin mode as well. Forced the re-installation of module as well as tried update. No luck, any help is appreciated!



Some additional guidance if you are getting the "The property 'SearchScope' cannot be found on this object. Verify that the property exists and can be set."


Exception when you try to execute the version, you are running either wrong version of PnP PowerShell OR you have SharePoint CSOM SDK installed on your machine which is not recommended.


If you have just updated to use the latest PnP PowerShell, move to "Add or Remove programs" in your computer and make sure that you do not have SharePoint Client Side CSOM SDK installed as that msi unfortunately installed assemblies to the GAC (Global Assembly Cache) and that overrides any local newer assembly versions, which is most likely the conflict here.

@Kerem Yuceturk 


Hello Kerem.  Two questions about this setting:

  • Does this apply to the new Global MS Search bar at the top as well?
  • Will changing this turn off library searching?


Thanks in advance!

Hi @tg_olympus, Yes, this will take effect for the new search box in the header as well.


This only applies to modern site search results.  Lists and Libraries will continue to search in that particular list or library. If you click on the link at the bottom of lists and libraries to expand the search, you will be able to get to modern site search results, which will respect this setting. 

@Kerem Yuceturk


Cool, we just tried it.  It works to a point but it seems to be still showing local results in the search results drop down.  Would that be fixed up in the future?




Thank you @tg_olympus! Yes, making the suggestions that appear under the search box to have the same scope is something the team is working on.

@Kerem Yuceturk 


I have updated the search scope using powershell on comms/teams site but still the results are getting redirected to site level


Powershell Result after running the script on site  :  $web.SearchScope


Can you confirm if i am missing something

@Kanwar Jot Singh 



Are the results that are not tenant wide in the searchbox or is it on the search results page after performing a search by hitting enter in the searchbox?


Also to verify that your site has been set to tenant you can try adding /_api/web to the end of the site url and searching in the text in the browser for searchscope and what value is set there.

@Geir-Magnus Pettersen 


Powershell result : SearchTenant.png


Search result in the site url after the change >> _layouts/15/search.aspx/siteall?q=keyword?




@Kanwar Jot Singh 


Setting looks correct, one thing we are working on is enabling hub sites for honoring the search scope. This is currently work in progress, so one source of this is if your communication site could be set up as hubsite? 


Could you please verify that your site is not a hubsite?

@Geir-Magnus Pettersen


No communication site is not a hub site, i also tested on Modern team site but it also did not work on that one also. 

@Kanwar Jot Singh, sending you a private message where we can try to figure out your specifics. 

Worked like a charm on my primary hub (comm) site. Thanks!
I noticed you can no longer see the Q&A cards in search results. Is this a known issue?
Is there any fix coming for team site as the feature doesn’t work on team sites

@Kerem Yuceturk  Greetings - Are there plans or is there a way to control what is displayed in the result details? For example we have a description in the page details, but the results return the first few lines on the page. Same with libraries or lists. Return title or subject information? 


~ Catherine

@RickyB, we noticed the issue as well where some of our users were not seeing the result cards, and addressed it recently. All Targeted Release users and tenants should see the answer cards now while they are searching at the organization level. We hope that this will be available more broadly by September. 

@Catherine Billick, we are working on a feature called modern display templates that will allow you to do this. My best estimate at the moment is that this will be available in the first half of 2020, we can provide a better estimate as we make more progress in our implementation.   

@Kerem Yuceturk - Super!  The feature will help the results be more user-friendly.  Thanks for the quick reply.

@Kerem Yuceturk 


I came here specifically looking for this feature, thank you for posting. Looking forward to updates to make it easier.


@Kerem Yuceturk -  Suggestion you may already have on your list.


Search result returns the site title.  Problem is it also returns the web address name of the list and library instead of the title which would be more user-friendly.


Example:  Document resides in a library with the title of "Employee-New" .  Web address for the library is newterm.  




I am using the Site administrator ID to make the changes but getting below error.

Invoke-PnPQuery : Access denied. You do not have permission to perform this action or access this resource.
At line:1 char:1
+ Invoke-PnPQuery
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Invoke-PnPQuery], ServerUnauthorizedAccessException
+ FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerUnauthorizedAccessException,SharePointPnP.PowerShell.Commands.Base.InvokeQuery

@Kerem Yuceturk Thanks for the tip. Worked as you described. The only think I noticed is on the modern site I changed when you do the initial refresh of the page the search object says "Search in Sharepoint" when I return to the original page it says "Search in your organization"


It still searches across our tenant so the search is working just the description doesn't seem right


Thanks again for the tip and the powershell code 

@chuckingerman, thank you for reporting this. We filed a bug on this and will address it as quickly as possible.

@RahulBrill, looks like a permission issue. Sorry it is hard to provide more guidance than that remotely. I'd look into all the security groups involved to make sure you have access, or try another admin user. 

Hi Kerem, this is a really useful feature, and will enable search on intranet sites to behave much more consistently. Thanks for enabling this!
Are there any plans to be able to modify the search settings to search the hub by default? For example if we have several Intranet sites connected to a hub it would be great if we could have an option to have all connected sites search all content in the hub by default. Ideally this would still bring back Promoted results which currently I know only feature if a global search is performed. Are there any plans for this?
I am hoping for this as well. We have just launched a new SPO intranet using modern SPO and hub sites and users are confused when searching from the hub vs searching on a child site.

I have been lead to believe they are working in this, and was told the following parameters values will eventually work for the various search scopes. I would love to get an update to know if it is still planned

DefaultScope = 0,
Tenant = 1,
Hub = 2,
Site = 3
@Kerem Yuceturk Is there any update on being able to set the scope to be sites in the hub? I tried it recently and it doesn't seem to work yet. My understanding is you were working on this and eventually a value of 2 for DefaultScope would do this.


@Kerem Yuceturk  : Thanks for post, it is really helpful. I have two questions

1) Can we configure Modern SharePoint site search with the enterprise search center site. i.e.add url of search results page in search settings of modern site? 

2) Can we add two result blocks in one Query rule, In my case I am adding one from SP onprem remote url and one from SP online. At a time only one result block display results in Modern site search.





I run into a similar issue, maybe someone has a good idea. I actually like the search scope to be at site level (like the default is), but have additionally the people search working for all our employees (AAD O365 accounts). Any trick to do that without coding stuff myself?



Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies