SharePoint hub site: Introduction

Introduction

SharePoint Hub Sites are similar to a Team or Communication site with additional capability to provide consistent navigation, news feed, site activities, look and feel, etc across other site collections which are associated to it. It also brings searchable content from the site associated to it.

Suppose for example, HR department in an organization has planned to have similar navigation, look and feel across all their site collection. An HR hub site can be created and all the related HR site collections like Finance, Resource Management & Recruitment Team etc can be associated to it.

Theory

Below is a diagrammatic representation of capabilities that SharePoint hub site provides.

Similar navigation – Similar navigation among associated sites
Content rollup – aggregated news &  site related activities
Search – Search in hub site brings content from all the associated sites.
Consistent look & feel – maintains consistent look & feel \ theme across all associated sites 

Create a SharePoint Hub Site Programmatically

​An existing Team site can be turned into a Hub site by running the below powershell command. Only Tenant Admin (Global or SharePoint admin) can turn a team or communication site into a hub site.

Pre-Requisite

Download latest version of SharePoint Online Management Shell and SharePoint PnP Powershell Online Module. Older version of these package installed in the system needs be removed if present.​

Create a Modern Team site using powershell

To create a modern team site using SharePoint PnP Powershell Command, run below command.

Connect-SPOService -Url "https://ramakrishnan-admin.sharepoint.com"
Connect-PnPOnline - SPOManagementShell
  New- PnPSite -Type TeamSite
  - title "HR Hub"
  - alias "HRHub"
  - Description "Hub Site for HR"

On successful run of command, URL of the site is returned.

Create a SharePoint hub site

To turn a modern team site or communication site into a hub site, run the below command.

Register-SPOHubSite -Site https://ramakrishnan.sharepoint.com/sites/HRHub

Here, we are converting Modern site created in previous section into a hub site. Following Output is expected.

If prompted for Principals[0], & if the requirement is to provide access to specific users. Provide UPN of the respective group, alternatively, Security group with email enabled can also be provided. Note, that this step is optional and in order to provide all site owners access to the hub site, press enter.

Associate a site to hub site using powershell

In order to associate a existing team site or communication site to a hub site, run the below command in windows powershell.

Note: It is recommended to create site with new template for Teams & Communication site as Hubsite functionality works perfectly for Modern experience. For Classic team site, changes will only reflect in Modern pages\experience.

Add-SPOHubSiteAssociation
  -Site https://ramakrishnan.sharepoint.com/sites/finance
  - HubSite https://ramakrishnan.sharepoint.com/sites/HRHub

Here, finance site(Modern Team site) is created & associated with HRHub (Hubsite)

Pictorial Representation

The above image represent Hub site and Finance site where finance site inherits the theme & global navigation from HRHubsite.

Command available & their operation

   
Add-SPOHubSiteAssociation To associate a site to a respective hubsite
Remove-SPOHubSiteAssociation To remove association between a site and a hub site
Get-SPOHubSite Lists hub sites or hub site information
Grant-SPOHubSiteRights Provides permission to specific users or security groups to access the hub site
Register-SPOHubSite Turns on the hub site feature on a site which converts it into a hub site
Revoke-SPOHubSiteRights Remove the permission for specified principals (groups or users) to access hub site
Set-SPOHubSite Save property of hub site like name, logo, description etc
Unregister-SPOHubSite Turns off the hub site feature on a site

Things to remember

  • One site can be associated to a only one hub site.
  • A hub site cannot be associated to another hub site.
  • A total of 50 Hub sites per tenant can be created which might increase over the future.
  • Sites inheriting hubsite does not inherit the permissions. Security\permission remains the same.
  • On SharePoint MultiGeo, only sites in the same geographic location can be associated
  • User making a search in Hub site will only see results they have access to.

Conclusion

 Thus in this article, functionality of Hub site and how it can be utilized in a tenant is explained.