Share via

How to set up search across multiple Sharepoint websites using my Sharepoint hub site?

Anonymous
2024-06-17T13:14:22+00:00

I have my Sharepoint Website Hub site and I want that in the search bar of this website, if I want to search for a file, to search it as well in another sharepoint website(which is not a hub site) but I don´t know how to link or include this website in my Sharepoint search.

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-06-17T17:16:02+00:00

    Hi caXB,

    Thanks for posting in the community. We are happy to help you.

    Based on your description, I assume you mean changing the search scope for the Hub site from "Search across sites" to "all sites in the tenant" (including sites not associated with the Hub site).

    If not, please point it out and let us know.

    If so, you (the tenant's Global admin or SharePoint admin) can run the following PowerShell script in SharePoint Online Management Shell to change the hub site's default search scope from the Site level (value= 0) to the Tenant level (value = 1). Remember to change the $SiteURL parameter to your hub site URL.

    For your reference:
    Get started with SharePoint Online Management Shell

    SharePoint Online: Change Default Search Scope from “Search This Site” to “Search All Sites”

    Disclaimer*: Microsoft provides no assurances and/or warranties, implied or otherwise, and is not responsible for the information you receive from the third-party linked sites or any support related to technology.*

    #Set Parameters

    $SiteURL = "https://crescent.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()

        #Set search scope for the web to global

        $Web.SearchScope = 1

        $web.Update()

        $Ctx.ExecuteQuery()

    }

    Catch {

        write-host -f Red "Error:" $_.Exception.Message

    }

    After that, users will be able to search across your tenant (all sites) when using your hub site's site search.

    If you have any updates or concerns about running the PowerShell script, please post back and let us know.

    We look forward to your response. Thanks for your cooperation.

    Sincerely,

    George | Microsoft Community Moderator

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments