Skip to main content
Tested the earlier solution, the joinHubSite does not seem to work on object that already is a hub itself. For this you can use the GetById method instead.
Source Link
Expiscornovus
  • 1.5k
  • 1
  • 5
  • 8

Edit: You cancan cannot use the JoinHubSite method in a Send an HTTP requestfor this.

You can use the GetById to SharePoint actionupdate 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-joinhubsite-method#http-requesthttps://learn.microsoft.com/en-us/sharepoint/dev/features/hub-site/rest-getbyid-method

Make sure you use the address of the newly created site in the Site Address field and the id of the Hubsite in theIn an example this would look like.

URI 

_api/siteHubSites/JoinHubSiteGetById(hubSiteId'@{outputs('Send_an_HTTP_request_to_SharePoint_-_RegisterHubSite')?['body']['ID']}')

If that still does not work can you please share a screenshot of your error and/or current flow setup?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

You can use the JoinHubSite method in a Send an HTTP request to SharePoint action.

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

Make sure you use the address of the newly created site in the Site Address field and the id of the Hubsite in the URI

_api/site/JoinHubSite(hubSiteId)

If that still does not work can you please share a screenshot of your error and/or current flow setup?

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

Source Link
Expiscornovus
  • 1.5k
  • 1
  • 5
  • 8

You can use the JoinHubSite method in a Send an HTTP request to SharePoint action.

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

Make sure you use the address of the newly created site in the Site Address field and the id of the Hubsite in the URI

_api/site/JoinHubSite(hubSiteId)

If that still does not work can you please share a screenshot of your error and/or current flow setup?