Create externalGroup
Article
03/02/2023
2 minutes to read
9 contributors
Feedback
In this article
Namespace: microsoft.graph.externalConnectors
Create a new externalGroup object.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
ExternalItem.ReadWrite.OwnedBy, ExternalItem.ReadWrite.All
Delegated (personal Microsoft account)
Not supported
Application
ExternalItem.ReadWrite.OwnedBy, ExternalItem.ReadWrite.All
HTTP request
POST /external/connections/{connectionsId}/groups
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, supply a JSON representation of the externalGroup object.
You can specify the following properties when creating an externalGroup .
Property
Type
Description
id
String
The unique ID of the external group within a connection. It must be alphanumeric and can be up to 128 characters long. Required.
displayName
String
The friendly name of the external group. Optional.
description
String
The description of the external group. Optional.
Response
If successful, this method returns a 201 Created
response code and an externalGroup object in the response body.
Example
Request
POST https://graph.microsoft.com/v1.0/external/connections/contosohr/groups
Content-Type: application/json
{
"id": "31bea3d537902000",
"displayName": "Contoso Marketing",
"description": "The product marketing team"
}
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Microsoft.Graph.Models.ExternalConnectors.ExternalGroup
{
Id = "31bea3d537902000",
DisplayName = "Contoso Marketing",
Description = "The product marketing team",
};
var result = await graphClient.External.Connections["{externalConnection-id}"].Groups.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const externalGroup = {
id: '31bea3d537902000',
displayName: 'Contoso Marketing',
description: 'The product marketing team'
};
await client.api('/external/connections/contosohr/groups')
.post(externalGroup);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
ExternalGroup externalGroup = new ExternalGroup();
externalGroup.id = "31bea3d537902000";
externalGroup.displayName = "Contoso Marketing";
externalGroup.description = "The product marketing team";
graphClient.external().connections("contosohr").groups()
.buildRequest()
.post(externalGroup);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewExternalGroup()
id := "31bea3d537902000"
requestBody.SetId(&id)
displayName := "Contoso Marketing"
requestBody.SetDisplayName(&displayName)
description := "The product marketing team"
requestBody.SetDescription(&description)
result, err := graphClient.External().ConnectionsById("externalConnection-id").Groups().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.Search
$params = @{
Id = "31bea3d537902000"
DisplayName = "Contoso Marketing"
Description = "The product marketing team"
}
New-MgExternalConnectionGroup -ExternalConnectionId $externalConnectionId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new ExternalGroup();
$requestBody->setId('31bea3d537902000');
$requestBody->setDisplayName('Contoso Marketing');
$requestBody->setDescription('The product marketing team');
$requestResult = $graphServiceClient->external()->connectionsById('externalConnection-id')->groups()->post($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "31bea3d537902000",
"displayName": "Contoso Marketing",
"description": "The product marketing team"
}