| title | conversationMember: remove |
|---|---|
| description | Remove members in bulk from a team. |
| author | prachigoyal-ms |
| doc_type | apiPageType |
| ms.localizationpriority | high |
| ms.subservice | teams |
| ms.date | 12/20/2024 |
Namespace: microsoft.graph
Remove multiple members from a team in a single request. The response provides details about which memberships could and couldn't be removed.
[!INCLUDE national-cloud-support]
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.
[!INCLUDE permissions-table]
This API is a bound action to remove multiple elements from a conversationMember collection in a single request.
POST /teams/{team-id}/members/remove| Header | Value |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Content-Type | application/json. Required. |
In the request body, supply the JSON representation of the list of conversationMember derivatives to be removed from a team. A maximum of 20 conversationMember derivatives can be removed in a single request.
The following table shows the parameter that you can use with this method.
| Parameter | Type | Description |
|---|---|---|
| values | conversationMember collection | A list of conversation members to remove. |
If successful, this method returns either a 204 No Content response if all specified members were successfully removed from the team or a 207 Multi-Status response if only some members were removed. The caller should inspect the response payload to identify which member removals failed. The response body contains a collection of derivatives of the actionResultPart resource. If the request fails, the API returns an error. For more information about Microsoft Graph errors, see Microsoft Graph error responses and resource types.
The following example shows how to remove multiple members from a team in a single request.
The following example shows a request.
POST https://graph.microsoft.com/v1.0/teams/e4183b04-c9a2-417c-bde4-70e3ee46a6dc/members/remove
Content-Type: application/json
{
"values": [
{
"@odata.type": "microsoft.graph.aadUserConversationMember",
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('18a80140-b0fb-4489-b360-2f6efaf225a0')"
},
{
"@odata.type": "microsoft.graph.aadUserConversationMember",
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('86503198-b81b-43fe-81ee-ad45b8848ac9')"
}
]
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 204 No ContentThe following example shows how to remove multiple members from a team in a single request using their user principal names.
The following example shows a request.
POST https://graph.microsoft.com/v1.0/teams/e4183b04-c9a2-417c-bde4-70e3ee46a6dc/members/remove
Content-Type: application/json
{
"values": [
{
"@odata.type": "microsoft.graph.aadUserConversationMember",
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('jacob@contoso.com')"
},
{
"@odata.type": "microsoft.graph.aadUserConversationMember",
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('alex@contoso.com')"
}
]
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 204 No ContentThe following example shows how to remove multiple members from a team when the removal of a member fails.
The following example shows a request.
POST https://graph.microsoft.com/v1.0/teams/e4183b04-c9a2-417c-bde4-70e3ee46a6dc/members/remove
Content-Type: application/json
{
"values": [
{
"@odata.type": "microsoft.graph.aadUserConversationMember",
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('c04f28bf-ab68-40a2-974b-e6af31fa78fb')"
},
{
"@odata.type": "microsoft.graph.aadUserConversationMember",
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('86503198-b81b-43fe-81ee-ad45b8848ac9')"
}
]
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 207 Multi-Status
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.aadUserConversationMemberResult)",
"value": [
{
"@odata.type": "#microsoft.graph.aadUserConversationMemberResult",
"userId": "c04f28bf-ab68-40a2-974b-e6af31fa78fb",
"error": {
"code": "NotFound",
"message": "Could not find resource"
}
},
{
"@odata.type": "#microsoft.graph.aadUserConversationMemberResult",
"userId": "86503198-b81b-43fe-81ee-ad45b8848ac9",
"error": null
}
]
}