conversationMember: remove

Namespace: microsoft.graph

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.

Remove multiple members from a team in a single request. The response provides details about which memberships could and couldn't be removed.

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) TeamMember.ReadWrite.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application TeamMember.ReadWrite.All Not available.

HTTP request

This is a bound action to remove multiple elements from a conversationMember collection in a single request.

POST /teams/{team-id}/members/remove

Request headers

Header Value
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

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 that should be removed.

Response

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.

Examples

Example 1: Remove members in bulk from a team

The following example shows how to remove multiple members from a team in a single request.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/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/beta/users('18a80140-b0fb-4489-b360-2f6efaf225a0')"
        },
        {
            "@odata.type": "microsoft.graph.aadUserConversationMember",
            "user@odata.bind": "https://graph.microsoft.com/beta/users('86503198-b81b-43fe-81ee-ad45b8848ac9')"
        }
    ]
}

Response

The following example shows the response.

HTTP/1.1 204 No Content

Example 2: Remove members in bulk from a team using user principal name

The following example shows how to remove multiple members from a team in a single request using their user principal names.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/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/beta/users('jacob@contoso.com')"
        },
        {
            "@odata.type": "microsoft.graph.aadUserConversationMember",
            "user@odata.bind": "https://graph.microsoft.com/beta/users('alex@contoso.com')"
        }
    ]
}

Response

The following example shows the response.

HTTP/1.1 204 No Content

Example 3: Remove members in bulk from a team with failed removals

The following example shows how to remove multiple members from a team when the removal of a member fails.

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/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/beta/users('c04f28bf-ab68-40a2-974b-e6af31fa78fb')"
        },
        {
            "@odata.type": "microsoft.graph.aadUserConversationMember",
            "user@odata.bind": "https://graph.microsoft.com/beta/users('86503198-b81b-43fe-81ee-ad45b8848ac9')"
        }
    ]
}

Response

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/beta/$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
        }
    ]
}

Remove member from team