Namespace: microsoft.graph.externalConnectors
Wichtig
Die APIs unter der /beta
Version in Microsoft Graph können sich ändern. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in v1.0 verfügbar ist, verwenden Sie die Version Selektor.
Erstellen Sie ein neues Schema, oder aktualisieren Sie ein vorhandenes Schema für eine Microsoft Search-Verbindung.
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
✅ |
✅ |
✅ |
❌ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. 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) |
ExternalConnection.ReadWrite.OwnedBy |
ExternalConnection.ReadWrite.All |
Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
Anwendung |
ExternalConnection.ReadWrite.OwnedBy |
ExternalConnection.ReadWrite.All |
HTTP-Anforderung
PATCH /external/connections/{id}/schema
Name |
Beschreibung |
Authorization |
Bearer {token}. Erforderlich. Erfahren Sie mehr über Authentifizierung und Autorisierung. |
Content-Type |
application/json. Erforderlich. |
Prefer: respond-async |
Verwenden Sie dies, um die Anforderung asynchron auszuführen. Optional. |
Anforderungstext
Geben Sie im Anforderungstext eine JSON-Darstellung eines Schemaobjekts an.
Wenn Sie ein benutzerdefiniertes Elementschema registrieren, muss für das Schemaobjekt die baseType-Eigenschaft auf microsoft.graph.externalItem
festgelegt sein und dieeigenschaft properties enthalten. Das Properties-Objektmuss mindestens eine Eigenschaft enthalten, maximal 128.
Antwort
Bei erfolgreicher Ausführung gibt die Methode einen 202 Accepted
Antwortcode und eine URL im Antwortheader zurück, die Location
verwendet werden können, um den Vorgang status abzurufen.
Anmerkung: Es kann zwischen 5 und 15 Minuten dauern, bis das Schema erstellt wurde. Es wird empfohlen, die URL im Location
Antwortheader zu verwenden, um den Vorgang status.
Beispiele
Anforderung
Das folgende Beispiel zeigt eine Anforderung, ein neues zu registrieren oder ein vorhandenes benutzerdefiniertes Schema asynchron zu aktualisieren.
PATCH https://graph.microsoft.com/beta/external/connections/contosohr/schema
Content-type: application/json
{
"baseType": "microsoft.graph.externalItem",
"properties": [
{
"name": "ticketTitle",
"type": "string",
"isSearchable": "true",
"isRetrievable": "true",
"labels": [
"title"
]
},
{
"name": "priority",
"type": "string",
"isQueryable": "true",
"isRetrievable": "true",
"isSearchable": "false"
},
{
"name": "assignee",
"type": "string",
"isRetrievable": "true"
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.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://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.External.Connections["{externalConnection-id}"].Schema.PatchAsync(requestBody);
mgc-beta external connections schema patch --external-connection-id {externalConnection-id} --body '{\
"baseType": "microsoft.graph.externalItem",\
"properties": [\
{\
"name": "ticketTitle",\
"type": "string",\
"isSearchable": "true",\
"isRetrievable": "true",\
"labels": [\
"title"\
]\
},\
{\
"name": "priority",\
"type": "string",\
"isQueryable": "true",\
"isRetrievable": "true",\
"isSearchable": "false"\
},\
{\
"name": "assignee",\
"type": "string",\
"isRetrievable": "true"\
}\
]\
}\
'
// 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.NewSchema()
baseType := "microsoft.graph.externalItem"
requestBody.SetBaseType(&baseType)
property := graphmodelsexternalconnectors.NewProperty()
name := "ticketTitle"
property.SetName(&name)
type := graphmodels.STRING_PROPERTYTYPE
property.SetType(&type)
isSearchable := true
property.SetIsSearchable(&isSearchable)
isRetrievable := true
property.SetIsRetrievable(&isRetrievable)
labels := []graphmodelsexternalconnectors.Labelable {
label := graphmodels.TITLE_LABEL
property.SetLabel(&label)
}
property.SetLabels(labels)
property1 := graphmodelsexternalconnectors.NewProperty()
name := "priority"
property1.SetName(&name)
type := graphmodels.STRING_PROPERTYTYPE
property1.SetType(&type)
isQueryable := true
property1.SetIsQueryable(&isQueryable)
isRetrievable := true
property1.SetIsRetrievable(&isRetrievable)
isSearchable := false
property1.SetIsSearchable(&isSearchable)
property2 := graphmodelsexternalconnectors.NewProperty()
name := "assignee"
property2.SetName(&name)
type := graphmodels.STRING_PROPERTYTYPE
property2.SetType(&type)
isRetrievable := true
property2.SetIsRetrievable(&isRetrievable)
properties := []graphmodelsexternalconnectors.Propertyable {
property,
property1,
property2,
}
requestBody.SetProperties(properties)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
schema, err := graphClient.External().Connections().ByExternalConnectionId("externalConnection-id").Schema().Patch(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.Schema schema = new com.microsoft.graph.beta.models.externalconnectors.Schema();
schema.setBaseType("microsoft.graph.externalItem");
LinkedList<com.microsoft.graph.beta.models.externalconnectors.Property> properties = new LinkedList<com.microsoft.graph.beta.models.externalconnectors.Property>();
com.microsoft.graph.beta.models.externalconnectors.Property property = new com.microsoft.graph.beta.models.externalconnectors.Property();
property.setName("ticketTitle");
property.setType(com.microsoft.graph.beta.models.externalconnectors.PropertyType.String);
property.setIsSearchable(true);
property.setIsRetrievable(true);
LinkedList<com.microsoft.graph.beta.models.externalconnectors.com.microsoft.graph.beta.models.externalconnectors.Label> labels = new LinkedList<com.microsoft.graph.beta.models.externalconnectors.com.microsoft.graph.beta.models.externalconnectors.Label>();
labels.add(com.microsoft.graph.beta.models.externalconnectors.Label.Title);
property.setLabels(labels);
properties.add(property);
com.microsoft.graph.beta.models.externalconnectors.Property property1 = new com.microsoft.graph.beta.models.externalconnectors.Property();
property1.setName("priority");
property1.setType(com.microsoft.graph.beta.models.externalconnectors.PropertyType.String);
property1.setIsQueryable(true);
property1.setIsRetrievable(true);
property1.setIsSearchable(false);
properties.add(property1);
com.microsoft.graph.beta.models.externalconnectors.Property property2 = new com.microsoft.graph.beta.models.externalconnectors.Property();
property2.setName("assignee");
property2.setType(com.microsoft.graph.beta.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);
const options = {
authProvider,
};
const client = Client.init(options);
const schema = {
baseType: 'microsoft.graph.externalItem',
properties: [
{
name: 'ticketTitle',
type: 'string',
isSearchable: 'true',
isRetrievable: 'true',
labels: [
'title'
]
},
{
name: 'priority',
type: 'string',
isQueryable: 'true',
isRetrievable: 'true',
isSearchable: 'false'
},
{
name: 'assignee',
type: 'string',
isRetrievable: 'true'
}
]
};
await client.api('/external/connections/contosohr/schema')
.version('beta')
.update(schema);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\Schema;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\Property;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\PropertyType;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\Label;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Schema();
$requestBody->setBaseType('microsoft.graph.externalItem');
$propertiesProperty1 = new Property();
$propertiesProperty1->setName('ticketTitle');
$propertiesProperty1->setType(new PropertyType('string'));
$propertiesProperty1->setIsSearchable(true);
$propertiesProperty1->setIsRetrievable(true);
$propertiesProperty1->setLabels([new Label('title'), ]);
$propertiesArray []= $propertiesProperty1;
$propertiesProperty2 = new Property();
$propertiesProperty2->setName('priority');
$propertiesProperty2->setType(new PropertyType('string'));
$propertiesProperty2->setIsQueryable(true);
$propertiesProperty2->setIsRetrievable(true);
$propertiesProperty2->setIsSearchable(false);
$propertiesArray []= $propertiesProperty2;
$propertiesProperty3 = new Property();
$propertiesProperty3->setName('assignee');
$propertiesProperty3->setType(new PropertyType('string'));
$propertiesProperty3->setIsRetrievable(true);
$propertiesArray []= $propertiesProperty3;
$requestBody->setProperties($propertiesArray);
$result = $graphServiceClient->external()->connections()->byExternalConnectionId('externalConnection-id')->schema()->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Search
$params = @{
baseType = "microsoft.graph.externalItem"
properties = @(
@{
name = "ticketTitle"
type = "string"
isSearchable = "true"
isRetrievable = "true"
labels = @(
"title"
)
}
@{
name = "priority"
type = "string"
isQueryable = "true"
isRetrievable = "true"
isSearchable = "false"
}
@{
name = "assignee"
type = "string"
isRetrievable = "true"
}
)
}
Update-MgBetaExternalConnectionSchema -ExternalConnectionId $externalConnectionId -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.schema import Schema
from msgraph_beta.generated.models.external_connectors.property import Property
from msgraph_beta.generated.models.property_type import PropertyType
from msgraph_beta.generated.models.external_connectors.label import Label
from msgraph_beta.generated.models.label import Label
# To initialize your graph_client, see https://learn.microsoft.com/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)
Antwort
Das folgende Beispiel zeigt die Antwort.
HTTP/1.1 202 Accepted
Location: https://graph.microsoft.com/beta/external/connections/contosohr/operations/616bfeed-666f-4ce0-8cd9-058939010bfc