Espace de noms : microsoft.graph.externalConnectors
Importante
Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Créez un nouvel élément externe.
Cette API peut être utilisée pour créer un élément personnalisé. Le conteneur externalConnection doit avoir un schéma enregistré du type correspondant.
Disponibilité de l’API
Cette API est disponible dans les déploiements cloud nationaux suivants.
| Service global |
Gouvernement américain L4 |
Gouvernement américain L5 (DOD) |
Chine exploitée par 21Vianet |
| ✅ |
✅ |
✅ |
❌ |
Autorisations
Choisissez l’autorisation ou les autorisations marquées comme étant les moins privilégiées pour cette API. Utilisez une ou plusieurs autorisations privilégiées uniquement si votre application en a besoin. Pour plus d’informations sur les autorisations déléguées et d’application, voir Types d’autorisations. Pour en savoir plus sur ces autorisations, consultez la référence des autorisations.
| Type d’autorisation |
Autorisations les moins privilégiées |
Autorisations à privilèges plus élevés |
| Déléguée (compte professionnel ou scolaire) |
ExternalItem.ReadWrite.OwnedBy |
ExternalItem.ReadWrite.All |
| Déléguée (compte Microsoft personnel) |
Non prise en charge. |
Non prise en charge. |
| Application |
ExternalItem.ReadWrite.OwnedBy |
ExternalItem.ReadWrite.All |
Requête HTTP
PUT /external/connections/{connection-id}/items/{item-id}
Paramètres du chemin d’accès
| Paramètre |
Type |
Description |
| ID de connexion |
string |
Propriété id de la connexion externe conteneur |
| item-id |
string |
Propriété fournie par id le développeur de l’élément externe. Si aucun élément n’existe déjà avec ce id, un nouvel élément est créé. Si un élément existe déjà avec ce id, il est remplacé par l’objet envoyé dans le corps. |
Corps de la demande
Dans le corps de la demande, fournissez une représentation JSON d’un objet externalItem . La charge utile est limitée à 30 Mo.
Lorsque vous créez un externalItem, les propriétés suivantes sont requises : acl et propriétés. L’objet de propriétés doit contenir au moins une propriété. Vous pouvez également utiliser la propriété informationProtectionLabel pour définir une étiquette de confidentialité Microsoft Purview sur un externalItem.
Toutes les DateTime propriétés de type doivent être au format ISO 8601.
Les propriétés d’un externalItem doivent utiliser des spécificateurs de type dans la charge utile dans les scénarios suivants :
Pour String les propriétés de type, si la valeur contient des caractères non ASCII.
"description@odata.type": "String",
"description": "Kandierte Äpfel"
Pour tous les types de collection.
"categories@odata.type": "Collection(String)"
"categories": [
"red",
"blue"
]
Importante
Lors de l’inclusion d’une propriété de type Collection(DateTime), vous devez utiliser le spécificateur Collection(DateTimeOffset)de type .
Réponse
Si elle réussit, cette méthode renvoie un code de réponse 200 OK.
Exemples
Exemple : créer un élément personnalisé
Demande
L’exemple suivant illustre une demande.
PUT https://graph.microsoft.com/beta/external/connections/contosohr/items/TSP228082938
Content-type: application/json
{
"acl": [
{
"type": "user",
"value": "e811976d-83df-4cbd-8b9b-5215b18aa874",
"accessType": "grant",
"identitySource": "azureActiveDirectory"
},
{
"type": "group",
"value": "14m1b9c38qe647f6a",
"accessType": "deny",
"identitySource": "external"
}
],
"properties": {
"title": "Fix issues with Payment gateway",
"priority": 1,
"assignee": "john@contoso.com"
},
"content": {
"value": "Payment gateway module has the following tasks to be completed...",
"type": "text"
},
"informationProtectionLabel": {
"sensitivityLabelId": "b6a62c3c-d471-4a3e-9f5f-93c1f928b02d"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.ExternalConnectors;
var requestBody = new ExternalItem
{
Acl = new List<Acl>
{
new Acl
{
Type = AclType.User,
Value = "e811976d-83df-4cbd-8b9b-5215b18aa874",
AccessType = AccessType.Grant,
IdentitySource = IdentitySourceType.AzureActiveDirectory,
},
new Acl
{
Type = AclType.Group,
Value = "14m1b9c38qe647f6a",
AccessType = AccessType.Deny,
IdentitySource = IdentitySourceType.External,
},
},
Properties = new Properties
{
AdditionalData = new Dictionary<string, object>
{
{
"title" , "Fix issues with Payment gateway"
},
{
"priority" , 1
},
{
"assignee" , "john@contoso.com"
},
},
},
Content = new ExternalItemContent
{
Value = "Payment gateway module has the following tasks to be completed...",
Type = ExternalItemContentType.Text,
},
InformationProtectionLabel = new ExternalItemInformationProtectionLabel
{
SensitivityLabelId = "b6a62c3c-d471-4a3e-9f5f-93c1f928b02d",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.External.Connections["{externalConnection-id}"].Items["{externalItem-id}"].PutAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodelsexternalconnectors "github.com/microsoftgraph/msgraph-beta-sdk-go/models/externalconnectors"
//other-imports
)
requestBody := graphmodelsexternalconnectors.NewExternalItem()
acl := graphmodelsexternalconnectors.NewAcl()
type := graphmodels.USER_ACLTYPE
acl.SetType(&type)
value := "e811976d-83df-4cbd-8b9b-5215b18aa874"
acl.SetValue(&value)
accessType := graphmodels.GRANT_ACCESSTYPE
acl.SetAccessType(&accessType)
identitySource := graphmodels.AZUREACTIVEDIRECTORY_IDENTITYSOURCETYPE
acl.SetIdentitySource(&identitySource)
acl1 := graphmodelsexternalconnectors.NewAcl()
type := graphmodels.GROUP_ACLTYPE
acl1.SetType(&type)
value := "14m1b9c38qe647f6a"
acl1.SetValue(&value)
accessType := graphmodels.DENY_ACCESSTYPE
acl1.SetAccessType(&accessType)
identitySource := graphmodels.EXTERNAL_IDENTITYSOURCETYPE
acl1.SetIdentitySource(&identitySource)
acl := []graphmodelsexternalconnectors.Aclable {
acl,
acl1,
}
requestBody.SetAcl(acl)
properties := graphmodelsexternalconnectors.NewProperties()
additionalData := map[string]interface{}{
"title" : "Fix issues with Payment gateway",
"priority" : int32(1) ,
"assignee" : "john@contoso.com",
}
properties.SetAdditionalData(additionalData)
requestBody.SetProperties(properties)
content := graphmodelsexternalconnectors.NewExternalItemContent()
value := "Payment gateway module has the following tasks to be completed..."
content.SetValue(&value)
type := graphmodels.TEXT_EXTERNALITEMCONTENTTYPE
content.SetType(&type)
requestBody.SetContent(content)
informationProtectionLabel := graphmodelsexternalconnectors.NewExternalItemInformationProtectionLabel()
sensitivityLabelId := "b6a62c3c-d471-4a3e-9f5f-93c1f928b02d"
informationProtectionLabel.SetSensitivityLabelId(&sensitivityLabelId)
requestBody.SetInformationProtectionLabel(informationProtectionLabel)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
items, err := graphClient.External().Connections().ByExternalConnectionId("externalConnection-id").Items().ByExternalItemId("externalItem-id").Put(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.beta.models.externalconnectors.ExternalItem externalItem = new com.microsoft.graph.beta.models.externalconnectors.ExternalItem();
LinkedList<com.microsoft.graph.beta.models.externalconnectors.Acl> acl = new LinkedList<com.microsoft.graph.beta.models.externalconnectors.Acl>();
com.microsoft.graph.beta.models.externalconnectors.Acl acl1 = new com.microsoft.graph.beta.models.externalconnectors.Acl();
acl1.setType(com.microsoft.graph.beta.models.externalconnectors.AclType.User);
acl1.setValue("e811976d-83df-4cbd-8b9b-5215b18aa874");
acl1.setAccessType(com.microsoft.graph.beta.models.externalconnectors.AccessType.Grant);
acl1.setIdentitySource(com.microsoft.graph.beta.models.externalconnectors.IdentitySourceType.AzureActiveDirectory);
acl.add(acl1);
com.microsoft.graph.beta.models.externalconnectors.Acl acl2 = new com.microsoft.graph.beta.models.externalconnectors.Acl();
acl2.setType(com.microsoft.graph.beta.models.externalconnectors.AclType.Group);
acl2.setValue("14m1b9c38qe647f6a");
acl2.setAccessType(com.microsoft.graph.beta.models.externalconnectors.AccessType.Deny);
acl2.setIdentitySource(com.microsoft.graph.beta.models.externalconnectors.IdentitySourceType.External);
acl.add(acl2);
externalItem.setAcl(acl);
com.microsoft.graph.beta.models.externalconnectors.Properties properties = new com.microsoft.graph.beta.models.externalconnectors.Properties();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("title", "Fix issues with Payment gateway");
additionalData.put("priority", 1);
additionalData.put("assignee", "john@contoso.com");
properties.setAdditionalData(additionalData);
externalItem.setProperties(properties);
com.microsoft.graph.beta.models.externalconnectors.ExternalItemContent content = new com.microsoft.graph.beta.models.externalconnectors.ExternalItemContent();
content.setValue("Payment gateway module has the following tasks to be completed...");
content.setType(com.microsoft.graph.beta.models.externalconnectors.ExternalItemContentType.Text);
externalItem.setContent(content);
com.microsoft.graph.beta.models.externalconnectors.ExternalItemInformationProtectionLabel informationProtectionLabel = new com.microsoft.graph.beta.models.externalconnectors.ExternalItemInformationProtectionLabel();
informationProtectionLabel.setSensitivityLabelId("b6a62c3c-d471-4a3e-9f5f-93c1f928b02d");
externalItem.setInformationProtectionLabel(informationProtectionLabel);
com.microsoft.graph.models.externalconnectors.ExternalItem result = graphClient.external().connections().byExternalConnectionId("{externalConnection-id}").items().byExternalItemId("{externalItem-id}").put(externalItem);
const options = {
authProvider,
};
const client = Client.init(options);
const externalItem = {
acl: [
{
type: 'user',
value: 'e811976d-83df-4cbd-8b9b-5215b18aa874',
accessType: 'grant',
identitySource: 'azureActiveDirectory'
},
{
type: 'group',
value: '14m1b9c38qe647f6a',
accessType: 'deny',
identitySource: 'external'
}
],
properties: {
title: 'Fix issues with Payment gateway',
priority: 1,
assignee: 'john@contoso.com'
},
content: {
value: 'Payment gateway module has the following tasks to be completed...',
type: 'text'
},
informationProtectionLabel: {
sensitivityLabelId: 'b6a62c3c-d471-4a3e-9f5f-93c1f928b02d'
}
};
await client.api('/external/connections/contosohr/items/TSP228082938')
.version('beta')
.put(externalItem);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\ExternalItem;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\Acl;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\AclType;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\AccessType;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\IdentitySourceType;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\Properties;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\ExternalItemContent;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\ExternalItemContentType;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\ExternalItemInformationProtectionLabel;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ExternalItem();
$aclAcl1 = new Acl();
$aclAcl1->setType(new AclType('user'));
$aclAcl1->setValue('e811976d-83df-4cbd-8b9b-5215b18aa874');
$aclAcl1->setAccessType(new AccessType('grant'));
$aclAcl1->setIdentitySource(new IdentitySourceType('azureActiveDirectory'));
$aclArray []= $aclAcl1;
$aclAcl2 = new Acl();
$aclAcl2->setType(new AclType('group'));
$aclAcl2->setValue('14m1b9c38qe647f6a');
$aclAcl2->setAccessType(new AccessType('deny'));
$aclAcl2->setIdentitySource(new IdentitySourceType('external'));
$aclArray []= $aclAcl2;
$requestBody->setAcl($aclArray);
$properties = new Properties();
$additionalData = [
'title' => 'Fix issues with Payment gateway',
'priority' => 1,
'assignee' => 'john@contoso.com',
];
$properties->setAdditionalData($additionalData);
$requestBody->setProperties($properties);
$content = new ExternalItemContent();
$content->setValue('Payment gateway module has the following tasks to be completed...');
$content->setType(new ExternalItemContentType('text'));
$requestBody->setContent($content);
$informationProtectionLabel = new ExternalItemInformationProtectionLabel();
$informationProtectionLabel->setSensitivityLabelId('b6a62c3c-d471-4a3e-9f5f-93c1f928b02d');
$requestBody->setInformationProtectionLabel($informationProtectionLabel);
$result = $graphServiceClient->external()->connections()->byExternalConnectionId('externalConnection-id')->items()->byExternalItemId('externalItem-id')->put($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Search
$params = @{
acl = @(
@{
type = "user"
value = "e811976d-83df-4cbd-8b9b-5215b18aa874"
accessType = "grant"
identitySource = "azureActiveDirectory"
}
@{
type = "group"
value = "14m1b9c38qe647f6a"
accessType = "deny"
identitySource = "external"
}
)
properties = @{
title = "Fix issues with Payment gateway"
priority =
assignee = "john@contoso.com"
}
content = @{
value = "Payment gateway module has the following tasks to be completed..."
type = "text"
}
informationProtectionLabel = @{
sensitivityLabelId = "b6a62c3c-d471-4a3e-9f5f-93c1f928b02d"
}
}
Set-MgBetaExternalConnectionItem -ExternalConnectionId $externalConnectionId -ExternalItemId $externalItemId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.external_connectors.external_item import ExternalItem
from msgraph_beta.generated.models.external_connectors.acl import Acl
from msgraph_beta.generated.models.acl_type import AclType
from msgraph_beta.generated.models.access_type import AccessType
from msgraph_beta.generated.models.identity_source_type import IdentitySourceType
from msgraph_beta.generated.models.external_connectors.properties import Properties
from msgraph_beta.generated.models.external_connectors.external_item_content import ExternalItemContent
from msgraph_beta.generated.models.external_item_content_type import ExternalItemContentType
from msgraph_beta.generated.models.external_connectors.external_item_information_protection_label import ExternalItemInformationProtectionLabel
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ExternalItem(
acl = [
Acl(
type = AclType.User,
value = "e811976d-83df-4cbd-8b9b-5215b18aa874",
access_type = AccessType.Grant,
identity_source = IdentitySourceType.AzureActiveDirectory,
),
Acl(
type = AclType.Group,
value = "14m1b9c38qe647f6a",
access_type = AccessType.Deny,
identity_source = IdentitySourceType.External,
),
],
properties = Properties(
additional_data = {
"title" : "Fix issues with Payment gateway",
"priority" : 1,
"assignee" : "john@contoso.com",
}
),
content = ExternalItemContent(
value = "Payment gateway module has the following tasks to be completed...",
type = ExternalItemContentType.Text,
),
information_protection_label = ExternalItemInformationProtectionLabel(
sensitivity_label_id = "b6a62c3c-d471-4a3e-9f5f-93c1f928b02d",
),
)
result = await graph_client.external.connections.by_external_connection_id('externalConnection-id').items.by_external_item_id('externalItem-id').put(request_body)
Réponse
L’exemple suivant illustre la réponse.
HTTP/1.1 200 OK