Monday, February 4, 2019

Should we use Power or PnP PowerShell to manage the SharePoint hub site and association?

With SharePoint hub sit become available and more popular these days, there are some requests to create hub sites and associate some sites to the hub site. It would be idea to use PowerShell to automate the process. There are two PowerShell implementation, the regular SharePoint online PowerShell and PnP PowerShell. The difference of these two PowerShell has been described on Microsoft community.

However, when I try to use them and compare to the latest SharePoint tenant admin UI, both of them have limitation that would cause issues. I would like to explain the limitation and how to create hub sites and associate the site to hub.

The new SharePoint online admin has added a new feature that you could register the hub site through UI. It will allow you to enter the "Display Name" like "My Hub". The display name will be displayed in the UI and will be used in hub site association.




However, if you use PowerShell, there is no parameter we can pass the the command for "Display Name" . As a result, the hub site registered but it will not be easy to find from the SharePoint online admin center.

Another issue is the hub site created from PowerShell will take sometime like few minutes so the Add-SPOHubSiteAssociation command will not fail but will not associate the site to hub!

After working with Microsoft, there is a second PowerShell to set the hub site title. Here is the command.

Set-SPOHubSite -Identity <Site URL> -Title "My hub site"

At this time I'm thinking he best approach to manage the hub sites and association is like the procedure below.

1. Create hub site from using PowerShell
2. Set hub site title using using PowerShell
2. Associate the site with hub site from either SPO PowerShell or PnP PowerShell
3. Report the hub site and association from PowerShell.

Hope this would help.




No comments:

Post a Comment