Reputation: 3
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 also tried to associate it manually (via sharepoint admin ) and it worked.
Upvotes: 0
Views: 484
Reputation: 1497
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')}"
}
Upvotes: 0