Elija el permiso o los permisos marcados como con privilegios mínimos para esta API. Use un permiso o permisos con privilegios superiores solo si la aplicación lo requiere. Para obtener más información sobre los permisos delegados y de aplicación, consulte Tipos de permisos. Para obtener más información sobre estos permisos, consulte la referencia de permisos.
Tipo de permiso
Permisos con privilegios mínimos
Permisos con privilegios más altos
Delegado (cuenta profesional o educativa)
Sites.Manage.All
Sites.FullControl.All
Delegado (cuenta personal de Microsoft)
No admitida.
No admitida.
Aplicación
Sites.Manage.All
Sites.FullControl.All
Solicitud HTTP
POST /sites/{siteId}/contentTypes/{contentTypeId}/associateWithHubSites
Nota:SiteId representa un sitio de concentrador de tipo de contenido.
En el cuerpo de la solicitud, proporcione una representación JSON de los parámetros.
La siguiente tabla muestra los parámetros que se pueden usar con esta acción.
Parámetro
Tipo
Descripción
hubSiteUrls
Collection(string)
Lista de direcciones URL canónicas a los sitios centrales donde se debe aplicar el tipo de contenido. Obligatorio.
propagateToExistingLists
Booleano
Si truees , los tipos de contenido se aplicarán en las listas existentes en los sitios centrales; de lo contrario, solo se aplicará a las listas recién creadas.
Respuesta
Si se ejecuta correctamente, esta acción devuelve un código de respuesta 204 No Content.
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)