Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
Sites.Manage.All
Sites.FullControl.All
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
Sites.Manage.All
Sites.FullControl.All
HTTP request
POST /sites/{siteId}/contentTypes/{contentTypeId}/associateWithHubSites
Note: The siteId represents a content type hub site.
POST https://graph.microsoft.com/v1.0/sites/{site-id}/contentTypes/{contentTypeId}/associateWithHubSites
Content-Type: application/json
{
"hubSiteUrls":[
"https://graph.microsoft.com/v1.0/sites/{site-id}"
],
"propagateToExistingLists":false
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Sites.Item.ContentTypes.Item.AssociateWithHubSites;
var requestBody = new AssociateWithHubSitesPostRequestBody
{
HubSiteUrls = new List<string>
{
"https://graph.microsoft.com/v1.0/sites/{site-id}",
},
PropagateToExistingLists = false,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Sites["{site-id}"].ContentTypes["{contentType-id}"].AssociateWithHubSites.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphsites "github.com/microsoftgraph/msgraph-sdk-go/sites"
//other-imports
)
requestBody := graphsites.NewAssociateWithHubSitesPostRequestBody()
hubSiteUrls := []string {
"https://graph.microsoft.com/v1.0/sites/{site-id}",
}
requestBody.SetHubSiteUrls(hubSiteUrls)
propagateToExistingLists := false
requestBody.SetPropagateToExistingLists(&propagateToExistingLists)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Sites().BySiteId("site-id").ContentTypes().ByContentTypeId("contentType-id").AssociateWithHubSites().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.sites.item.contenttypes.item.associatewithhubsites.AssociateWithHubSitesPostRequestBody associateWithHubSitesPostRequestBody = new com.microsoft.graph.sites.item.contenttypes.item.associatewithhubsites.AssociateWithHubSitesPostRequestBody();
LinkedList<String> hubSiteUrls = new LinkedList<String>();
hubSiteUrls.add("https://graph.microsoft.com/v1.0/sites/{site-id}");
associateWithHubSitesPostRequestBody.setHubSiteUrls(hubSiteUrls);
associateWithHubSitesPostRequestBody.setPropagateToExistingLists(false);
graphClient.sites().bySiteId("{site-id}").contentTypes().byContentTypeId("{contentType-id}").associateWithHubSites().post(associateWithHubSitesPostRequestBody);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Sites\Item\ContentTypes\Item\AssociateWithHubSites\AssociateWithHubSitesPostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AssociateWithHubSitesPostRequestBody();
$requestBody->setHubSiteUrls(['https://graph.microsoft.com/v1.0/sites/{site-id}', ]);
$requestBody->setPropagateToExistingLists(false);
$graphServiceClient->sites()->bySiteId('site-id')->contentTypes()->byContentTypeId('contentType-id')->associateWithHubSites()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.sites.item.contenttypes.item.associate_with_hub_sites.associate_with_hub_sites_post_request_body import AssociateWithHubSitesPostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AssociateWithHubSitesPostRequestBody(
hub_site_urls = [
"https://graph.microsoft.com/v1.0/sites/{site-id}",
],
propagate_to_existing_lists = False,
)
await graph_client.sites.by_site_id('site-id').content_types.by_content_type_id('contentType-id').associate_with_hub_sites.post(request_body)