Office 365 Software Development
Apek Group Image-1-2 Converting your SharePoint Online Root Site to a Hub Site with PowerShell

Converting your SharePoint Online Root Site to a Hub Site with PowerShell

What is a Hub Site?

A SharePoint hub site is an intranet building block that helps bring related sites together to roll up news and activity, simplify search, create a shared navigation, and for the general look and feel. It is a concept that is meant to help organizations connect and organize sites based on certain organizational attributes such as project, department, division, region, etc. and makes it easier to organize your intranet dynamically.


Apek Group Image-1-2 Converting your SharePoint Online Root Site to a Hub Site with PowerShell

Features of a Hub site

Shared Navigation – A top navigation defined in the hub site is inherited by other sites associated with it.
Consistent look and feel – All sites associated with a hub site automatically inherit the theme and logo, which helps maintain a consistent look and feel across the site collections.
News and Content roll up – Contents such as news and activity from other sites associated with a Hub site when published can be read from the Hub.
Scoped search – When you search for content from a hub site, it searches for content on other sites associated with it and returns the results.
Site activities – Activities of users on all sites associated with a hub site are also visible on it.

Now that we understand what SharePoint hub sites are let’s get right into the business of the day.


Step 1

Download and Install SharePoint Online Management Shell here
Note: If you already have this installed, skip this step

Step 2

Open your SharePoint Online Management Shell and type:

Install-Module -Name Microsoft.Online.SharePoint.PowerShell.

This is to help install the SharePoint Online PowerShell module.

Apek Group Image-2-1 Converting your SharePoint Online Root Site to a Hub Site with PowerShell

Step 3

Get your Office 365 credentials and save as a variable by using:

$cred = Get-Credential

You will be prompted to enter your username and password.

Apek Group Image-3-2 Converting your SharePoint Online Root Site to a Hub Site with PowerShell

Step 4

Connect to the SharePoint Admin Centre using:

Connect-SPOService -Url https://yourdomain-admin.sharepoint.com -Credential $cred

Note: you must be a SharePoint Admin on the tenant to perform this.

Apek Group Image-4-2 Converting your SharePoint Online Root Site to a Hub Site with PowerShell

Step 5

Register-SPOHubSite -Site https://yourdomain.sharepoint.com -Principals $null

Apek Group Image-5 Converting your SharePoint Online Root Site to a Hub Site with PowerShell

That’s it!!!
Your root site is now registered as a hub site.


Unregister a Hub site

If you wish to un-register it as a hub at any time, use the following command:

UnRegister-SPOHubSite https://yourdomain.sharepoint.com

Apek Group Image-6-1 Converting your SharePoint Online Root Site to a Hub Site with PowerShell

Associate a site collection with a hub

Let’s say we want to associate our IT site to a hub we will use a command like:

Add-SPOHubSiteAssociation https://yourdomain.sharepoint.com/sites/IT -HubSite https://yourdomain.sharepoint.com

Apek Group Image-7 Converting your SharePoint Online Root Site to a Hub Site with PowerShell

Dissociate a site collection from a hub

Remove-SPOHubSiteAssociation “https://yourdomain.sharepoint.com/sites/IT”


For more PowerShell cmdlets for SharePoint hub sites, click here


Author

Tunde Akande