Skip to main content
Version: 2.100.0

New Group/Team

Using the EasyLife 365 Collaboration API, you can seamlessly create groups or teams based on existing templates and their associated policies.

info

The selected template determines whether the resource created will be a Microsoft 365 Group or a Microsoft 365 Teams Team.

warning

When creating a Microsoft Team, ensure that the user calling the API has a valid Teams license assigned.

Permissions

Permission typePermissions (also known as scope)
Delegated (work or school account)https://api.easylife365.cloud/collab/App.ReadWrite.All
ApplicationNot supported.

HTTP Request

POST https://api.easylife365.cloud/collab/v1/groups/
Content-Type: application/json

HTTP Request headers

HeaderValue
AuthorizationBearer token. Required.
Content-Typeapplication/json

Request Body

PropertyTypeDescription
displayNameStringName of the group. Required
descriptionStringDescription of the group. Optional
templateIdStringTemplate identifier. Required
memberShipTypeNumberMembership of the group. Optional
0 - private - only specific people can join
1 - public - anyone can join
2 - dynamic - use rules to determine group membership based on user or device properties.
ownersArray of StringList of owners of the group. Optional.
The currently logged on user is automatically added.
metadataObjectList of fields represented as key/value pairs. Optional
labelIdStringSensitivity labelId for the group. Optional
membersArray of StringList of owners of the group. Optional

Response

Upon queuing the request, the API responds with the following payload:

{
"requestId": "72d2f4b8-76fe-4140-9460-3c7ef9091cb5",
"tenantId": "1840b34e-6fe7-4a56-9ad3-0b7b58c49dc7",
"approvalRequired": false
}

The requestId serves as an identifier for all activities related to the creation process. Upon creation, the respective provisioning webhook configured on the template receives a payload containing the corresponding requestId.

Example 1: Creating a Group

The following example demonstrates creating a private group with custom metadata and a sensitivity label.

POST https://api.easylife365.cloud/collab/v1/groups/
Content-Type: application/json
{
"displayName": "My Group Name",
"description": "This is an example of how to create groups using the API!",
"templateId": "2fd0dba8-d2fe-4b51-866b-622d7fa3c22b",
"memberShipType": 0,
"owners": [
"49cf935a-284f-4c84-8df7-a5b11f1be527"
],
"metadata": {
"el-text-945": "A custom text field's value!",
"el-check-917": true
},
"labelId": "0f53416f-806f-4b11-b2b2-9d721be7ac64",
"members": [
"6a95c23b-cbb3-4f06-9b05-5e96ac65c78c"
]
}

Example 2: Creating a Group using PowerShell

The next example illustrates creating a Group using PowerShell. You need to register an application and add the TenantId and ClientId from that application in the script. Ensure that you retrieve the correct scope from this document.

Import-Module MSAL.PS

$msalParam = @{
tenantId = "[TENANT_ID]"
clientId = "[CLIENT_ID]"
scopes = "[SCOPE]"
}
$uri = "[URI]"

# Get JWT authentication token.
if($token){
$token = Get-MsalToken @msalParam -Silent
} else {
$token = Get-MsalToken @msalParam -DeviceCode
}

# create object with the values to pass to the API
$body = @{
displayName = "My Group Name 2"
description = "This is an example of how to create groups using the API!"
templateId = "2fd0dba8-d2fe-4b51-866b-622d7fa3c22b"
memberShipType = 0
owners= @("49cf935a-284f-4c84-8df7-a5b11f1be527")
members = @("6a95c23b-cbb3-4f06-9b05-5e96ac65c78c")
}

# invoke the API and get responses
$jsonBody = $body | ConvertTo-Json -Depth 5 -Compress
$encodedBody = [System.Text.Encoding]::UTF8.GetBytes($jsonBody)

$headers = @{
"Authorization"="Bearer $($token.AccessToken)"
"Content-Type" = "application/json"
}

Write-Information "create group with: $jsonBody" -InformationAction Continue

$response = Invoke-RestMethod -Method post -Uri $uri -Headers $headers -Body $encodedBody
$response