Dans le corps de la demande, fournissez une représentation JSON d’un objet de schéma .
Lorsque vous inscrivez un schéma d’élément personnalisé, la propriétébaseTypedoit être définie sur microsoft.graph.externalItemet doit contenir la propriété properties. L’objet propertiesdoit contenir au moins une propriété, jusqu’à un maximum de 128.
Réponse
Si elle réussit, cette méthode renvoie un 202 Accepted code de réponse et une URL dans l’en-tête Location de réponse qui peuvent être utilisés pour obtenir l’état de l’opération.
Note: La création du schéma peut prendre entre 5 et 15 minutes. Nous vous recommandons d’utiliser l’URL dans l’en-tête Location de réponse pour obtenir l’état de l’opération.
Exemples
Demande
L’exemple suivant montre une demande d’inscription ou de mise à jour d’un schéma personnalisé existant de façon asynchrone.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models.ExternalConnectors;
var requestBody = new Schema
{
BaseType = "microsoft.graph.externalItem",
Properties = new List<Property>
{
new Property
{
Name = "ticketTitle",
Type = PropertyType.String,
IsSearchable = true,
IsRetrievable = true,
Labels = new List<Label?>
{
Label.Title,
},
},
new Property
{
Name = "priority",
Type = PropertyType.String,
IsQueryable = true,
IsRetrievable = true,
IsSearchable = false,
},
new Property
{
Name = "assignee",
Type = PropertyType.String,
IsRetrievable = true,
},
},
};
// To initialize your graphClient, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.External.Connections["{externalConnection-id}"].Schema.PatchAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.models.externalconnectors.Schema schema = new com.microsoft.graph.models.externalconnectors.Schema();
schema.setBaseType("microsoft.graph.externalItem");
LinkedList<com.microsoft.graph.models.externalconnectors.Property> properties = new LinkedList<com.microsoft.graph.models.externalconnectors.Property>();
com.microsoft.graph.models.externalconnectors.Property property = new com.microsoft.graph.models.externalconnectors.Property();
property.setName("ticketTitle");
property.setType(com.microsoft.graph.models.externalconnectors.PropertyType.String);
property.setIsSearchable(true);
property.setIsRetrievable(true);
LinkedList<com.microsoft.graph.models.externalconnectors.com.microsoft.graph.models.externalconnectors.Label> labels = new LinkedList<com.microsoft.graph.models.externalconnectors.com.microsoft.graph.models.externalconnectors.Label>();
labels.add(com.microsoft.graph.models.externalconnectors.Label.Title);
property.setLabels(labels);
properties.add(property);
com.microsoft.graph.models.externalconnectors.Property property1 = new com.microsoft.graph.models.externalconnectors.Property();
property1.setName("priority");
property1.setType(com.microsoft.graph.models.externalconnectors.PropertyType.String);
property1.setIsQueryable(true);
property1.setIsRetrievable(true);
property1.setIsSearchable(false);
properties.add(property1);
com.microsoft.graph.models.externalconnectors.Property property2 = new com.microsoft.graph.models.externalconnectors.Property();
property2.setName("assignee");
property2.setType(com.microsoft.graph.models.externalconnectors.PropertyType.String);
property2.setIsRetrievable(true);
properties.add(property2);
schema.setProperties(properties);
com.microsoft.graph.models.externalconnectors.Schema result = graphClient.external().connections().byExternalConnectionId("{externalConnection-id}").schema().patch(schema);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.external_connectors.schema import Schema
from msgraph.generated.models.external_connectors.property import Property
from msgraph.generated.models.property_type import PropertyType
from msgraph.generated.models.external_connectors.label import Label
from msgraph.generated.models.label import Label
# To initialize your graph_client, see https://zcusa.951200.xyz/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Schema(
base_type = "microsoft.graph.externalItem",
properties = [
Property_(
name = "ticketTitle",
type = PropertyType.String,
is_searchable = True,
is_retrievable = True,
labels = [
Label.Title,
],
),
Property_(
name = "priority",
type = PropertyType.String,
is_queryable = True,
is_retrievable = True,
is_searchable = False,
),
Property_(
name = "assignee",
type = PropertyType.String,
is_retrievable = True,
),
],
)
result = await graph_client.external.connections.by_external_connection_id('externalConnection-id').schema.patch(request_body)