Skip to content

Commit bbd36a0

Browse files
authored
Merge pull request #26205 from microsoftgraph/fixUUF-groupMembers
Fix UUF - correct group-post-members.md syntax + examples
2 parents 23ced68 + 1925f65 commit bbd36a0

File tree

2 files changed

+62
-17
lines changed

2 files changed

+62
-17
lines changed

api-reference/beta/api/group-post-members.md

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The following table shows the least privileged permission that's required by eac
5555

5656
```http
5757
POST /groups/{group-id}/members/$ref
58-
POST /groups/{group-id}/members/
58+
PATCH /groups/{group-id}/members
5959
```
6060

6161
## Request headers
@@ -67,11 +67,16 @@ POST /groups/{group-id}/members/
6767

6868
## Request body
6969

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.
7171

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.
7580

7681
## Response
7782

@@ -82,9 +87,11 @@ If successful, this method returns a `204 No Content` response code. It returns
8287

8388
## Example
8489

85-
### Request
90+
### Example 1: Add a member to a group
8691

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.
8895

8996
# [HTTP](#tab/http)
9097

@@ -136,9 +143,44 @@ Content-type: application/json
136143

137144
---
138145

139-
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.
161+
162+
#### Request
163+
164+
The following example shows a request.
165+
<!-- {
166+
"blockType": "request",
167+
"name": "add_multiple_members_to_group"
168+
}-->
169+
170+
```http
171+
PATCH https://graph.microsoft.com/beta/groups/{group-id}
172+
Content-type: application/json
173+
174+
{
175+
"members@odata.bind": [
176+
"https://graph.microsoft.com/beta/directoryObjects/{id}",
177+
"https://graph.microsoft.com/beta/directoryObjects/{id}",
178+
"https://graph.microsoft.com/beta/directoryObjects/{id}"
179+
]
180+
}
181+
```
140182

141-
### Response
183+
#### Response
142184

143185
The following example shows the response.
144186

api-reference/v1.0/api/group-post-members.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The following table shows the least privileged permission that's required by eac
5353

5454
```http
5555
POST /groups/{group-id}/members/$ref
56-
POST /groups/{group-id}/members/
56+
PATCH /groups/{group-id}/members
5757
```
5858

5959
## Request headers
@@ -65,11 +65,16 @@ POST /groups/{group-id}/members/
6565

6666
## Request body
6767

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.
6969

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.
7378

7479
## Response
7580

@@ -136,8 +141,6 @@ Content-type: application/json
136141

137142
---
138143

139-
In the request body, supply a JSON representation of the id of the directoryObject, user, or group object you want to add.
140-
141144
#### Response
142145

143146
The following example shows the response.
@@ -152,7 +155,7 @@ HTTP/1.1 204 No Content
152155

153156
### Example 2: Add multiple members to a group in a single request
154157

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.
156159

157160
#### Request
158161

0 commit comments

Comments
 (0)