Forum Discussion
How to associate Hub site to the site created without Office 365 Group using CSOM
I could resolve this issue.
Details:
We are creating Modern Team site without Office 365 group using CSOM. Using Tenant.CreateSite() method as
var tenant = new Tenant(tenantContext);
var spo = tenant.CreateSite(siteCreationProperties);
And then used the Tenant.ConnectSiteToHubSite() method to connect it to Hub site as
//Associating new site to Hub site
tenant.ConnectSiteToHubSite(siteUrl, HubsiteURL);
ccTennant.ExecuteQuery();
It seems to be working fine for me now.
Thanks all for replying and helping 🙂
If I am associating a SPO site with hubsite with multigeo scenario means SPO site and hubsite are at different geolocation, then tenantContext will be used of which? site or hubsite?
here in the line
var tenant = new Tenant(tenantContext);
Here , while creating tenantContext, which SiteUrl will be passed? it should be of hubsite or SPO site to be associated.