Wählen Sie für diese API die Als am wenigsten privilegierten Berechtigungen gekennzeichneten Berechtigungen aus. Verwenden Sie nur dann eine Berechtigung mit höheren Berechtigungen , wenn dies für Ihre App erforderlich ist. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
Berechtigungstyp
Berechtigungen mit den geringsten Berechtigungen
Berechtigungen mit höheren Berechtigungen
Delegiert (Geschäfts-, Schul- oder Unikonto)
Sites.Manage.All
Sites.FullControl.All
Delegiert (persönliches Microsoft-Konto)
Nicht unterstützt
Nicht unterstützt
Anwendung
Sites.Manage.All
Sites.FullControl.All
HTTP-Anforderung
POST /sites/{siteId}/contentTypes/{contentTypeId}/associateWithHubSites
Hinweis: Die siteId stellt eine Inhaltstyp-Hubwebsite dar.
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)