POST /external/connections/{connectionsId}/groups/{externalGroupId}/members
Request headers
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, supply a JSON representation of the identity object.
You can specify the following properties when creating an identity resource for a member in an externalGroup.
Property
Type
Description
id
String
The unique id of the member. It would be the objectId in case of Azure Active Directory users or groups and the externalGroupId in case of external groups. Required.
type
microsoft.graph.externalConnectors.identityType
The type of member added to the external group. Possible values are: user,group, externalGroup. Required.
Response
If successful, this method returns a 201 Created response code and an identity object in the response body.
Examples
Example 1: Add an Azure Active Directory user as a member
POST https://graph.microsoft.com/v1.0/external/connections/contosohr/groups/31bea3d537902000/members
Content-Type: application/json
{
"id": "e811976d-83df-4cbd-8b9b-5215b18aa874",
"type": "user"
}
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Microsoft.Graph.Models.ExternalConnectors.Identity
{
Id = "e811976d-83df-4cbd-8b9b-5215b18aa874",
Type = Microsoft.Graph.Models.ExternalConnectors.IdentityType.User,
};
var result = await graphClient.External.Connections["{externalConnection-id}"].Groups["{externalGroup-id}"].Members.PostAsync(requestBody);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Identity();
$requestBody->setId('e811976d-83df-4cbd-8b9b-5215b18aa874');
$requestBody->setType(new IdentityType('user'));
$result = $graphServiceClient->external()->connections()->byConnectionId('externalConnection-id')->groups()->byGroupId('externalGroup-id')->members()->post($requestBody);
POST https://graph.microsoft.com/v1.0/external/connections/contosohr/groups/31bea3d537902000/members
Content-Type: application/json
{
"id": "e5477431-1038-484e-bf69-1dfedb97a110",
"type": "group"
}
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Microsoft.Graph.Models.ExternalConnectors.Identity
{
Id = "e5477431-1038-484e-bf69-1dfedb97a110",
Type = Microsoft.Graph.Models.ExternalConnectors.IdentityType.Group,
};
var result = await graphClient.External.Connections["{externalConnection-id}"].Groups["{externalGroup-id}"].Members.PostAsync(requestBody);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Identity();
$requestBody->setId('e5477431-1038-484e-bf69-1dfedb97a110');
$requestBody->setType(new IdentityType('group'));
$result = $graphServiceClient->external()->connections()->byConnectionId('externalConnection-id')->groups()->byGroupId('externalGroup-id')->members()->post($requestBody);
POST https://graph.microsoft.com/v1.0/external/connections/contosohr/groups/31bea3d537902000/members
Content-Type: application/json
{
"id": "1431b9c38ee647f6a",
"type": "externalGroup",
}
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Microsoft.Graph.Models.ExternalConnectors.Identity
{
Id = "1431b9c38ee647f6a",
Type = Microsoft.Graph.Models.ExternalConnectors.IdentityType.ExternalGroup,
};
var result = await graphClient.External.Connections["{externalConnection-id}"].Groups["{externalGroup-id}"].Members.PostAsync(requestBody);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Identity();
$requestBody->setId('1431b9c38ee647f6a');
$requestBody->setType(new IdentityType('externalgroup'));
$result = $graphServiceClient->external()->connections()->byConnectionId('externalConnection-id')->groups()->byGroupId('externalGroup-id')->members()->post($requestBody);