SharePoint Modern Search

Pbala 1 Reputation point
2021-10-20T15:54:44.983+00:00

Hi,

In Modern SharePoint search, where can I change the default search scope to point to https://xxxx. sharepoint.com/_layouts/15/search.aspx?q=xxx instead of
https://xxxx.sharepoint.com/_layouts/15/search.aspx/siteall?q=xxx

Thanks

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,789 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Echo Du_MSFT 17,176 Reputation points
    2021-10-21T02:17:09.86+00:00

    Hello @Pbala ,

    Welcome to Q&A Forum!

    Please run the below PowerShell script to change default search scope in SharePoint Online as site collection admin:

    #Set Parameters  
    $SiteURL = "https://xxxx.sharepoint.com"  
       
    #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()  
       
        #Set search scope for the web to global  
        $Web.SearchScope = 1  
        $web.Update()  
        $Ctx.ExecuteQuery()  
    }  
    Catch {  
        write-host -f Red "Error:" $_.Exception.Message  
    }  
    

    Search scope enumeration values:

    • DefaultScope = 0
    • Tenant = 1
    • Hub = 2
    • Site = 3

    142243-1.png

    142322-2.png

    142244-3.png

    Thanks,
    Echo Du

    ================================

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.