0

in a test tenant I'm trying to deploy a flow in Power Automate that allows me to automatically create Sharepoint sites, assign permissions and join parent hub sites.

How does it work? The flow has as its trigger a list with the various fields that are filled in and allow the creation of sites with the data that is passed.

Everything works fine, except for joining an hub site to another hub site (parent hub). When I try to do that, the flows stops with an error and says that the site is an hub yet and I can't join to parent.

How can I solve it? Is there a way to achieve this goal? I couldn't find anything on the internet about this.

Can somebody please help me?

Thanks.

  • I tried to join the parent hub site and then register it as hub site but it went in error telling me that I was doing an unauthorized operation. I've checked all my permissions and they're fine.

I also tried to associate it manually (via sharepoint admin ) and it worked.

1 Answer 1

0

Edit: You can cannot use the JoinHubSite method for this.

You can use the GetById to update the settings of the newly create hub site. One of the properties is the ParentHubSiteId, this is the one which you can update.

Below are the docs of this REST API method: https://learn.microsoft.com/en-us/sharepoint/dev/features/hub-site/rest-getbyid-method

In an example this would look like.

URI

_api/HubSites/GetById('@{outputs('Send_an_HTTP_request_to_SharePoint_-_RegisterHubSite')?['body']['ID']}')

Headers

{
      "Accept": "application/json;odata=verbose",
      "Content-Type": "application/json;odata=verbose",
      "X-HTTP-Method": "MERGE",
      "If-Match": "*"
}

Body

{
    "__metadata": { "type": "SP.HubSite" },
    "Title":"New Hub Site Title",
    "Description":"",
    "LogoUrl": "",
    "ParentHubSiteId":"@{variables('HubSiteId')}"
}

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.