Namespace: microsoft.graph.externalConnectors
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Create a new externalItem.
This API can be used to create a custom item. The containing externalConnection must have a schema registered of the corresponding type.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
ExternalItem.ReadWrite.OwnedBy |
ExternalItem.ReadWrite.All |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
ExternalItem.ReadWrite.OwnedBy |
ExternalItem.ReadWrite.All |
HTTP request
PUT /external/connections/{connection-id}/items/{item-id}
Path parameters
Parameter |
Type |
Description |
connection-id |
string |
The id property of the containing externalConnection |
item-id |
string |
The developer-provided id property of the externalItem. If no item already exists with this id , a new item is created. If an item already exists with this id , it is overwritten by the object sent in the body. |
Request body
In the request body, supply a JSON representation of an externalItem object. The payload is limited to 4 MB.
Creating an externalItem
When creating an externalItem
, the following fields are required: acl
, and properties
. The properties
object must contain at least one property.
All DateTime
type properties must be in ISO 8601 format.
Properties on an externalItem
should use type specifiers in the payload in the following scenarios:
For String
type properties, if the value contains non-ASCII characters.
"description@odata.type": "String",
"description": "Kandierte Äpfel"
For all collection types.
"categories@odata.type": "Collection(String)"
"categories": [
"red",
"blue"
]
Important
When including a property of type Collection(DateTime)
, you must use the type specifier Collection(DateTimeOffset)
.
Response
If successful, this method returns 200 OK
response code.
Examples
Example: Create a custom item
Request
The following example shows a request.
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": "Error in the payment gateway",
"priority": 1,
"assignee": "john@contoso.com"
},
"content": {
"value": "Error in payment gateway...",
"type": "text"
}
}
// 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" , "Error in the payment gateway"
},
{
"priority" , 1
},
{
"assignee" , "john@contoso.com"
},
},
},
Content = new ExternalItemContent
{
Value = "Error in payment gateway...",
Type = ExternalItemContentType.Text,
},
};
// 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" : "Error in the payment gateway",
"priority" : int32(1) ,
"assignee" : "john@contoso.com",
}
properties.SetAdditionalData(additionalData)
requestBody.SetProperties(properties)
content := graphmodelsexternalconnectors.NewExternalItemContent()
value := "Error in payment gateway..."
content.SetValue(&value)
type := graphmodels.TEXT_EXTERNALITEMCONTENTTYPE
content.SetType(&type)
requestBody.SetContent(content)
// 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", "Error in the 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("Error in payment gateway...");
content.setType(com.microsoft.graph.beta.models.externalconnectors.ExternalItemContentType.Text);
externalItem.setContent(content);
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: 'Error in the payment gateway',
priority: 1,
assignee: 'john@contoso.com'
},
content: {
value: 'Error in payment gateway...',
type: 'text'
}
};
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;
$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' => 'Error in the payment gateway',
'priority' => 1,
'assignee' => 'john@contoso.com',
];
$properties->setAdditionalData($additionalData);
$requestBody->setProperties($properties);
$content = new ExternalItemContent();
$content->setValue('Error in payment gateway...');
$content->setType(new ExternalItemContentType('text'));
$requestBody->setContent($content);
$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 = "Error in the payment gateway"
priority =
assignee = "john@contoso.com"
}
content = @{
value = "Error in payment gateway..."
type = "text"
}
}
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
# 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" : "Error in the payment gateway",
"priority" : 1,
"assignee" : "john@contoso.com",
}
),
content = ExternalItemContent(
value = "Error in payment gateway...",
type = ExternalItemContentType.Text,
),
)
result = await graph_client.external.connections.by_external_connection_id('externalConnection-id').items.by_external_item_id('externalItem-id').put(request_body)
Response
The following example shows the response.
HTTP/1.1 200 OK