|
| 1 | +--- |
| 2 | +title: "conversationMember: remove" |
| 3 | +description: "Remove members in bulk from a team." |
| 4 | +author: "prachigoyal-ms" |
| 5 | +doc_type: "apiPageType" |
| 6 | +ms.localizationpriority: high |
| 7 | +ms.subservice: "teams" |
| 8 | +--- |
| 9 | + |
| 10 | +# conversationMember: remove |
| 11 | + |
| 12 | +Namespace: microsoft.graph |
| 13 | + |
| 14 | +[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)] |
| 15 | + |
| 16 | +Remove multiple members from a [team](../resources/team.md) in a single request. The response provides details about which memberships could and couldn't be removed. |
| 17 | + |
| 18 | +[!INCLUDE [national-cloud-support](../../includes/all-clouds.md)] |
| 19 | + |
| 20 | +## Permissions |
| 21 | + |
| 22 | +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](/graph/permissions-overview#best-practices-for-using-microsoft-graph-permissions). For details about delegated and application permissions, see [Permission types](/graph/permissions-overview#permission-types). To learn more about these permissions, see the [permissions reference](/graph/permissions-reference). |
| 23 | + |
| 24 | +<!-- { "blockType": "permissions", "name": "conversationmember_remove" } --> |
| 25 | +[!INCLUDE [permissions-table](../includes/permissions/conversationmember-remove-permissions.md)] |
| 26 | + |
| 27 | + |
| 28 | +## HTTP request |
| 29 | + |
| 30 | +This is a bound action to remove multiple elements from a [conversationMember](../resources/conversationmember.md) collection in a single request. |
| 31 | +<!-- { "blockType": "ignored" } --> |
| 32 | + |
| 33 | +```http |
| 34 | +POST /teams/{team-id}/members/remove |
| 35 | +``` |
| 36 | + |
| 37 | +## Request headers |
| 38 | + |
| 39 | +| Header | Value | |
| 40 | +| :------------ | :------------------------ | |
| 41 | +|Authorization|Bearer {token}. Required. Learn more about [authentication and authorization](/graph/auth/auth-concepts).| |
| 42 | +| Content-Type | application/json. Required. | |
| 43 | + |
| 44 | +## Request body |
| 45 | + |
| 46 | +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. |
| 47 | + |
| 48 | +The following table shows the parameter that you can use with this method. |
| 49 | + |
| 50 | +|Parameter|Type|Description| |
| 51 | +|:---|:---|:---| |
| 52 | +|values|[conversationMember](../resources/conversationmember.md) collection|A list of conversation members that should be removed.| |
| 53 | + |
| 54 | +## Response |
| 55 | + |
| 56 | +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](../resources/actionresultpart.md) 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](/graph/errors). |
| 57 | + |
| 58 | +## Examples |
| 59 | + |
| 60 | +### Example 1: Remove members in bulk from a team |
| 61 | + |
| 62 | +The following example shows how to remove multiple members from a **team** in a single request. |
| 63 | + |
| 64 | +#### Request |
| 65 | + |
| 66 | +The following example shows a request. |
| 67 | + |
| 68 | +<!-- { |
| 69 | + "blockType": "request", |
| 70 | + "name": "bulkremovemembers_team" |
| 71 | +}--> |
| 72 | + |
| 73 | +```http |
| 74 | +POST https://graph.microsoft.com/beta/teams/e4183b04-c9a2-417c-bde4-70e3ee46a6dc/members/remove |
| 75 | +Content-Type: application/json |
| 76 | +
|
| 77 | +{ |
| 78 | + "values": [ |
| 79 | + { |
| 80 | + "@odata.type": "microsoft.graph.aadUserConversationMember", |
| 81 | + "user@odata.bind": "https://graph.microsoft.com/beta/users('18a80140-b0fb-4489-b360-2f6efaf225a0')" |
| 82 | + }, |
| 83 | + { |
| 84 | + "@odata.type": "microsoft.graph.aadUserConversationMember", |
| 85 | + "user@odata.bind": "https://graph.microsoft.com/beta/users('86503198-b81b-43fe-81ee-ad45b8848ac9')" |
| 86 | + } |
| 87 | + ] |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +#### Response |
| 92 | + |
| 93 | +The following example shows the response. |
| 94 | + |
| 95 | +<!-- { |
| 96 | + "blockType": "response", |
| 97 | + "truncated": false |
| 98 | +} --> |
| 99 | + |
| 100 | +```http |
| 101 | +HTTP/1.1 204 No Content |
| 102 | +``` |
| 103 | + |
| 104 | +### Example 2: Remove members in bulk from a team using user principal name |
| 105 | + |
| 106 | +The following example shows how to remove multiple members from a **team** in a single request using their user principal names. |
| 107 | + |
| 108 | +#### Request |
| 109 | + |
| 110 | +The following example shows a request. |
| 111 | + |
| 112 | +<!-- { |
| 113 | + "blockType": "request", |
| 114 | + "name": "bulkdeletemembers_team_upn" |
| 115 | +}--> |
| 116 | + |
| 117 | +```http |
| 118 | +POST https://graph.microsoft.com/beta/teams/e4183b04-c9a2-417c-bde4-70e3ee46a6dc/members/remove |
| 119 | +Content-Type: application/json |
| 120 | +
|
| 121 | +{ |
| 122 | + "values": [ |
| 123 | + { |
| 124 | + "@odata.type": "microsoft.graph.aadUserConversationMember", |
| 125 | + "user@odata.bind": "https://graph.microsoft.com/beta/users('jacob@contoso.com')" |
| 126 | + }, |
| 127 | + { |
| 128 | + "@odata.type": "microsoft.graph.aadUserConversationMember", |
| 129 | + "user@odata.bind": "https://graph.microsoft.com/beta/users('alex@contoso.com')" |
| 130 | + } |
| 131 | + ] |
| 132 | +} |
| 133 | +``` |
| 134 | + |
| 135 | +#### Response |
| 136 | + |
| 137 | +The following example shows the response. |
| 138 | + |
| 139 | +<!-- { |
| 140 | + "blockType": "response", |
| 141 | + "truncated": false |
| 142 | +} --> |
| 143 | + |
| 144 | +```http |
| 145 | +HTTP/1.1 204 No Content |
| 146 | +``` |
| 147 | + |
| 148 | +### Example 3: Remove members in bulk from a team with failed removals |
| 149 | + |
| 150 | +The following example shows how to remove multiple members from a **team** when the removal of a member fails. |
| 151 | + |
| 152 | +#### Request |
| 153 | + |
| 154 | +The following example shows a request. |
| 155 | + |
| 156 | +<!-- { |
| 157 | + "blockType": "request", |
| 158 | + "name": "bulkdeletemembers_team_partial" |
| 159 | +}--> |
| 160 | + |
| 161 | +```http |
| 162 | +POST https://graph.microsoft.com/beta/teams/e4183b04-c9a2-417c-bde4-70e3ee46a6dc/members/remove |
| 163 | +Content-Type: application/json |
| 164 | +
|
| 165 | +{ |
| 166 | + "values": [ |
| 167 | + { |
| 168 | + "@odata.type": "microsoft.graph.aadUserConversationMember", |
| 169 | + "user@odata.bind": "https://graph.microsoft.com/beta/users('c04f28bf-ab68-40a2-974b-e6af31fa78fb')" |
| 170 | + }, |
| 171 | + { |
| 172 | + "@odata.type": "microsoft.graph.aadUserConversationMember", |
| 173 | + "user@odata.bind": "https://graph.microsoft.com/beta/users('86503198-b81b-43fe-81ee-ad45b8848ac9')" |
| 174 | + } |
| 175 | + ] |
| 176 | +} |
| 177 | +``` |
| 178 | + |
| 179 | +#### Response |
| 180 | + |
| 181 | +The following example shows the response. |
| 182 | + |
| 183 | +> **Note:** The response object shown here might be shortened for readability. |
| 184 | +<!-- { |
| 185 | + "blockType": "response", |
| 186 | + "truncated": true, |
| 187 | + "@odata.type": "Collection(microsoft.graph.actionResultPart)" |
| 188 | +} --> |
| 189 | + |
| 190 | +```http |
| 191 | +HTTP/1.1 207 Multi-Status |
| 192 | +Content-Type: application/json |
| 193 | +
|
| 194 | +{ |
| 195 | + "@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.aadUserConversationMemberResult)", |
| 196 | + "value": [ |
| 197 | + { |
| 198 | + "@odata.type": "#microsoft.graph.aadUserConversationMemberResult", |
| 199 | + "userId": "c04f28bf-ab68-40a2-974b-e6af31fa78fb", |
| 200 | + "error": { |
| 201 | + "code": "NotFound", |
| 202 | + "message": "Could not find resource" |
| 203 | + } |
| 204 | + }, |
| 205 | + { |
| 206 | + "@odata.type": "#microsoft.graph.aadUserConversationMemberResult", |
| 207 | + "userId": "86503198-b81b-43fe-81ee-ad45b8848ac9", |
| 208 | + "error": null |
| 209 | + } |
| 210 | + ] |
| 211 | +} |
| 212 | +``` |
| 213 | + |
| 214 | +## Related content |
| 215 | + |
| 216 | +[Remove member from team](team-delete-members.md) |
| 217 | + |
| 218 | +<!-- uuid: 8fcb5dbc-d5aa-4681-8e31-b001d5168d79 |
| 219 | +2024-09-12 06:02:30 UTC --> |
| 220 | +<!-- |
| 221 | +{ |
| 222 | + "type": "#page.annotation", |
| 223 | + "description": "Remove members from a team in bulk.", |
| 224 | + "keywords": "", |
| 225 | + "section": "documentation", |
| 226 | + "tocPath": "", |
| 227 | + "suppressions": [] |
| 228 | +} |
| 229 | +--> |
| 230 | + |
0 commit comments