You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: api-reference/beta/api/group-post-members.md
+51-9Lines changed: 51 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ The following table shows the least privileged permission that's required by eac
55
55
56
56
```http
57
57
POST /groups/{group-id}/members/$ref
58
-
POST /groups/{group-id}/members/
58
+
PATCH /groups/{group-id}/members
59
59
```
60
60
61
61
## Request headers
@@ -67,11 +67,16 @@ POST /groups/{group-id}/members/
67
67
68
68
## Request body
69
69
70
-
When using the `/groups/{group-id}/members/$ref` syntax, supply a JSON object that contains an **@odata.id** property with a reference by ID to a supported group member object type.
70
+
When using the `POST /groups/{group-id}/members/$ref` syntax, supply a JSON object that contains an **@odata.id** property with a reference by ID to a supported group member object type.
71
71
72
-
When using the `/groups/{group-id}/members` syntax, supply a JSON object that contains a **members@odata.bind** property with one or more references by IDs to a supported group member object type.
73
-
74
-
If using the **directoryObjects** reference, that is, `https://graph.microsoft.com/v1.0/directoryObjects/{id}`, the object type must still be a supported group member object type.
72
+
When using the `PATCH /groups/{group-id}/members` syntax, supply a JSON object that contains a **members@odata.bind** property with one or more references by IDs to a supported group member object type. That is:
73
+
- For Microsoft 365 groups, only `https://graph.microsoft.com/v1.0/directoryObjects/{id}` and `https://graph.microsoft.com/v1.0/groups/{id}` is allowed where `{id}` must be a user because only users can members of Microsoft 365 groups.
74
+
- For security groups, the following ID references are allowed:
75
+
-`https://graph.microsoft.com/v1.0/directoryObjects/{id}` where `{id}` must belong to a user, security group, device, service principal, or organizational contact.
76
+
-`https://graph.microsoft.com/v1.0/groups/{id}` where `{id}` must belong to another security group. Microsoft 365 groups can't be members of security groups.
77
+
-`https://graph.microsoft.com/v1.0/devices/{id}` where `{id}` belongs to a device.
78
+
-`https://graph.microsoft.com/v1.0/servicePrincipal/{id}` where `{id}` belongs to a service principal.
79
+
-`https://graph.microsoft.com/v1.0/orgContact/{id}` where `{id}` belongs to an organizational contact.
75
80
76
81
## Response
77
82
@@ -82,9 +87,11 @@ If successful, this method returns a `204 No Content` response code. It returns
82
87
83
88
## Example
84
89
85
-
### Request
90
+
### Example 1: Add a member to a group
86
91
87
-
The following example shows a request.
92
+
#### Request
93
+
94
+
The following example shows a request that uses the **directoryObjects** reference to add a member to a group.
In the request body, supply a JSON representation of the `id` of the [directoryObject](../resources/directoryobject.md), [user](../resources/user.md), or [group](../resources/group.md) object you want to add.
146
+
#### Response
147
+
148
+
The following example shows the response.
149
+
150
+
<!-- {
151
+
"blockType": "response"
152
+
} -->
153
+
154
+
```http
155
+
HTTP/1.1 204 No Content
156
+
```
157
+
158
+
### Example 2: Add multiple members to a group in a single request
159
+
160
+
This example shows how to add multiple members to a group with OData bind support in a PATCH operation. Up to 20 members can be added in a single request. If an error condition exists in the request body, no members are added and the appropriate response code is returned.
Copy file name to clipboardExpand all lines: api-reference/v1.0/api/group-post-members.md
+11-8Lines changed: 11 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ The following table shows the least privileged permission that's required by eac
53
53
54
54
```http
55
55
POST /groups/{group-id}/members/$ref
56
-
POST /groups/{group-id}/members/
56
+
PATCH /groups/{group-id}/members
57
57
```
58
58
59
59
## Request headers
@@ -65,11 +65,16 @@ POST /groups/{group-id}/members/
65
65
66
66
## Request body
67
67
68
-
When using the `/groups/{group-id}/members/$ref` syntax, supply a JSON object that contains an **@odata.id** property with a reference by ID to a supported group member object type.
68
+
When using the `POST /groups/{group-id}/members/$ref` syntax, supply a JSON object that contains an **@odata.id** property with a reference by ID to a supported group member object type.
69
69
70
-
When using the `/groups/{group-id}/members` syntax, supply a JSON object that contains a **members@odata.bind** property with one or more references by IDs to a supported group member object type.
71
-
72
-
If using the **directoryObjects** reference, that is, `https://graph.microsoft.com/v1.0/directoryObjects/{id}`, the object type must still be a supported group member object type.
70
+
When using the `PATCH /groups/{group-id}/members` syntax, supply a JSON object that contains a **members@odata.bind** property with one or more references by IDs to a supported group member object type. That is:
71
+
- For Microsoft 365 groups, only `https://graph.microsoft.com/v1.0/directoryObjects/{id}` and `https://graph.microsoft.com/v1.0/groups/{id}` is allowed where `{id}` must be a user because only users can members of Microsoft 365 groups.
72
+
- For security groups, the following ID references are allowed:
73
+
-`https://graph.microsoft.com/v1.0/directoryObjects/{id}` where `{id}` must belong to a user, security group, device, service principal, or organizational contact.
74
+
-`https://graph.microsoft.com/v1.0/groups/{id}` where `{id}` must belong to another security group. Microsoft 365 groups can't be members of security groups.
75
+
-`https://graph.microsoft.com/v1.0/devices/{id}` where `{id}` belongs to a device.
76
+
-`https://graph.microsoft.com/v1.0/servicePrincipal/{id}` where `{id}` belongs to a service principal.
77
+
-`https://graph.microsoft.com/v1.0/orgContact/{id}` where `{id}` belongs to an organizational contact.
In the request body, supply a JSON representation of the id of the directoryObject, user, or group object you want to add.
140
-
141
144
#### Response
142
145
143
146
The following example shows the response.
@@ -152,7 +155,7 @@ HTTP/1.1 204 No Content
152
155
153
156
### Example 2: Add multiple members to a group in a single request
154
157
155
-
This example shows how to add multiple members to a group with OData bind support in a PATCH operation. Up to 20 members can be added in a single request. The POST operation isn't supported. If an error condition exists in the request body, no members are added and the appropriate response code is returned.
158
+
This example shows how to add multiple members to a group with OData bind support in a PATCH operation. Up to 20 members can be added in a single request. If an error condition exists in the request body, no members are added and the appropriate response code is returned.
0 commit comments