スキーマの作成
-
[アーティクル]
-
-
名前空間: microsoft.graph.externalConnectors
新しい スキーマ オブジェクトを作成します。
アクセス許可
この API を呼び出すには、次のいずれかのアクセス許可が必要です。アクセス許可の選択方法などの詳細については、「アクセス許可」を参照してください。
| アクセス許可の種類 |
アクセス許可 (特権の小さいものから大きいものへ) |
| 委任 (職場または学校のアカウント) |
ExternalConnection.ReadWrite.OwnedBy, ExternalConnection.ReadWrite.All |
| 委任 (個人用 Microsoft アカウント) |
該当なし |
| アプリケーション |
ExternalConnection.ReadWrite.OwnedBy, ExternalConnection.ReadWrite.All |
HTTP 要求
POST /external/connections/{id}/schema
要求本文で、スキーマ オブジェクトの JSON 表現を指定 します 。
カスタム項目スキーマを登録する場合、スキーマ オブジェクトには baseType プロパティが設定microsoft.graph.externalItemされ、プロパティ プロパティが含まれている 必要があります。 properties オブジェクトには、最大 128 のプロパティを少なくとも 1 つ含める 必要があります。
応答
成功した場合、このメソッドは202 Accepted応答コードと、操作の状態をLocation取得するために使用できる応答ヘッダーの URL を返します。
例
例: カスタム スキーマを非同期的に登録する
要求
要求の例を次に示します。
POST https://graph.microsoft.com/v1.0/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"
}
]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var schema = new Microsoft.Graph.ExternalConnectors.Schema
{
BaseType = "microsoft.graph.externalItem",
Properties = new List<Microsoft.Graph.ExternalConnectors.Property>()
{
new Microsoft.Graph.ExternalConnectors.Property
{
Name = "ticketTitle",
Type = Microsoft.Graph.ExternalConnectors.PropertyType.String,
IsSearchable = true,
IsRetrievable = true,
Labels = new List<Microsoft.Graph.ExternalConnectors.Label>()
{
Microsoft.Graph.ExternalConnectors.Label.Title
}
},
new Microsoft.Graph.ExternalConnectors.Property
{
Name = "priority",
Type = Microsoft.Graph.ExternalConnectors.PropertyType.String,
IsQueryable = true,
IsRetrievable = true,
IsSearchable = false
},
new Microsoft.Graph.ExternalConnectors.Property
{
Name = "assignee",
Type = Microsoft.Graph.ExternalConnectors.PropertyType.String,
IsRetrievable = true
}
}
};
await graphClient.External.Connections["{externalConnectors.externalConnection-id}"].Schema
.Request()
.AddAsync(schema);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
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')
.post(schema);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/external/connections/contosohr/schema"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphExternalConnectorsSchema *schema = [[MSGraphExternalConnectorsSchema alloc] init];
[schema setBaseType:@"microsoft.graph.externalItem"];
NSMutableArray *propertiesList = [[NSMutableArray alloc] init];
MSGraphExternalConnectorsProperty *properties = [[MSGraphExternalConnectorsProperty alloc] init];
[properties setName:@"ticketTitle"];
[properties setType: [MSGraphExternalConnectorsPropertyType string]];
[properties setIsSearchable:@"true"];
[properties setIsRetrievable:@"true"];
NSMutableArray *labelsList = [[NSMutableArray alloc] init];
[labelsList addObject: @"title"];
[properties setLabels:labelsList];
[propertiesList addObject: properties];
MSGraphExternalConnectorsProperty *properties = [[MSGraphExternalConnectorsProperty alloc] init];
[properties setName:@"priority"];
[properties setType: [MSGraphExternalConnectorsPropertyType string]];
[properties setIsQueryable:@"true"];
[properties setIsRetrievable:@"true"];
[properties setIsSearchable:@"false"];
[propertiesList addObject: properties];
MSGraphExternalConnectorsProperty *properties = [[MSGraphExternalConnectorsProperty alloc] init];
[properties setName:@"assignee"];
[properties setType: [MSGraphExternalConnectorsPropertyType string]];
[properties setIsRetrievable:@"true"];
[propertiesList addObject: properties];
[schema setProperties:propertiesList];
NSError *error;
NSData *schemaData = [schema getSerializedDataWithError:&error];
[urlRequest setHTTPBody:schemaData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Schema schema = new Schema();
schema.baseType = "microsoft.graph.externalItem";
LinkedList<Property> propertiesList = new LinkedList<Property>();
Property properties = new Property();
properties.name = "ticketTitle";
properties.type = PropertyType.STRING;
properties.isSearchable = false;
properties.isRetrievable = false;
LinkedList<Label> labelsList = new LinkedList<Label>();
labelsList.add(Label.TITLE);
properties.labels = labelsList;
propertiesList.add(properties);
Property properties1 = new Property();
properties1.name = "priority";
properties1.type = PropertyType.STRING;
properties1.isQueryable = false;
properties1.isRetrievable = false;
properties1.isSearchable = false;
propertiesList.add(properties1);
Property properties2 = new Property();
properties2.name = "assignee";
properties2.type = PropertyType.STRING;
properties2.isRetrievable = false;
propertiesList.add(properties2);
schema.properties = propertiesList;
graphClient.external().connections("contosohr").schema()
.buildRequest()
.post(schema);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
requestBody.SetAdditionalData(map[string]interface{}{
"baseType": "microsoft.graph.externalItem",
"properties": []Object {
}
}
externalConnectionId := "externalConnection-id"
graphClient.External().ConnectionsById(&externalConnectionId).Schema().Post(requestBody)
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
応答
応答の例を次に示します。
HTTP/1.1 202 Accepted
Location: https://graph.microsoft.com/v1.0/external/connections/contosohr/operations/616bfeed-666f-4ce0-8cd9-058939010bfc