Have you noticed that the SharePoint connector in Microsoft Flow was extended with a number of action helping you to manage hub sites?

There are now the following actions available:

  • Approve hub site join request
  • Cancel hub site join request
  • Join hub site
  • Set hub site join status to pending

It is a bit disappointing that there aren’t any triggers on the creation of a site in SharePoint. I could imagine that it would be nice to have a process that kicks off a hub site join process when a site is created. Having said that I could also simply extend my Provision your sites without any code a bit and make the process hookup the site created with the correct the hub site.

Before I start looking at the above actions I’ve first created two modern sites. One modern team site and one modern communication site.

  • Intranet
  • Extranet

Then I turned both of these sites into hub sites by following the Create a hub site in SharePoint Online article and I created a few test sites and I configured my hub site to have a navigation that includes the links to by sites.

 

Time to start playing with Flow. I created a simple flow that join a site to a hub site.

Huh, what is that GUID?

By running the Get-SPOHubSite Cmdlet you can get the GUID of your hub site.

Ok, this is still a bit ugly and I really hope that the hub sites will be listed as available options within the Join hub site action soon

But it all worked! and that is the most important thing of course. My IT site now shows up with the hub site navigation.

 

Ok, there is more!

There are 3 actions related to approval of hub sites.

  • Approve hub site join request
  • Cancel hub site join request
  • Set hub site join status to pending

This is where the complicated stuff starts. Earlier we saw that it is easy to join a hub site, but what if you don’t have permissions to join that site.

I created a flow with my test user account. This user isn’t a manager of the hub sites. Somehow my test user managed to get the GUID for the hub site, but when flow tried to connect you will now see a Forbidden warning and the error details show Access denied. You do not have permission to perform this action or access this resource. Well this is clear enough. Personally I’m not sure why a user without permissions to a hub site would possibly want to add a site to a hub site, but I’m sure that over time there may be some use cases for that.

Time to try the Set hub site join status to pending

The above action feels a bit strange. I’m requesting to join a hub site, but I’m not being asked what I would like to join. A bit like walking into a shop asking for a product but not know what product you would want to buy.

This looks like the same error as earlier but it is not! You get this error when you try to join a hub site where you aren’t the site collection administrator. The next step is to create a new team site as my test user and run my flow again

 

Ok, this now worked. But what happened?

 

All the above action did was queuing the request

Now I can use the Approval system in flow to ensure that the request is actually approved or rejected. Note that this needs to be run by the owner of the hub site again.

What another GUID needed??

I used PnP PowerShell this time to get my site GUID.

 

Connect-PNPOnline https://pieterveenstramvp.sharepoint.com/sites/Client3

$site = Get-PnPSite

$ctx = Get-PnPContext

$ctx.Load($site)

$ctx.ExecuteQuery()

$site.Id

And now I’ve got my site Id and when I run my flow

I now got my ApprovalToken which can be used in the Join hub site

My Conclusions

It is great to see that hub sites can be joined using Flow. However I would be surprised to see if many organisations will be able to get this to work even after reading this post. The need to collect GUIDs for each site almost forces the need for a site request flow as described in my earlier mentioned post. Just so that the GUIDs can be collected as the sites are created. This makes it potentially complicated to use these new hub site related actions.

Having said all of that I can very much see the potential for these actions and with a little bit more work done to them it will be a lot easier to manage your hub sites using Flow.

Advertisements