Reputation: 49774
Is there a Microsoft Graph API to list users in group email like the feature Outlook has?
If this API exists, when use it on
[email protected]
it will list
- [email protected]
- [email protected]
- [email protected]
- etc.
UPDATE 1: tried
GET /groups/[email protected]/members
on Graph Explorer (have access Directory.ReadWrite.All)
But error 400
{
"error": {
"code": "Request_BadRequest",
"message": "Invalid object identifier '[email protected]'.",
"innerError": {
"request-id": "dad057af-2b67-4186-bc8c-df2b10fc2d0c",
"date": "2018-02-02T09:53:51"
}
}
}
UPDATE 2: tried
GET /groups?$filter=mail eq '[email protected]'
GET /groups?$filter=mailNickname eq 'group1engineers'
Both get same results, still no group members show up (this group has 7 members):
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups",
"value": [
{
"id": "4822c6e4-91b5-4db8-ae1a-2a52353f8c28",
"deletedDateTime": null,
"classification": null,
"createdDateTime": "2017-09-01T08:13:42Z",
"description": null,
"displayName": "Group 1 Engineers",
"groupTypes": [],
"mail": "[email protected]",
"mailEnabled": true,
"mailNickname": "group1engineers",
"onPremisesLastSyncDateTime": "2017-11-16T20:47:17Z",
"onPremisesProvisioningErrors": [],
"onPremisesSecurityIdentifier": "S-1-5-21-2127521184-1604012920-1887927527-28525981",
"onPremisesSyncEnabled": true,
"preferredDataLocation": null,
"proxyAddresses": [
"x500:/o=ExchangeLabs/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=63886b35b89a410dacad845a76016073-GROUP1ENGINEERS",
"X500:/o=microsoft/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=3f0ecc97b6be4ff08bac734225ae5a30-GROUP1ENGINEERS",
"X500:/o=microsoft/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=beac216013b54a78a81cad98bdb34df0-GROUP1ENGINEERS",
"smtp:[email protected]",
"smtp:[email protected]",
"smtp:[email protected]",
"SMTP:[email protected]"
],
"renewedDateTime": "2017-09-01T08:13:42Z",
"securityEnabled": false,
"visibility": null
}
]
}
Upvotes: 0
Views: 2257
Reputation: 3461
Yes, you can get the group members using the Graph API. From https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/group_list_members:
GET https://graph.microsoft.com/v1.0/groups/{id}/members
Note that it isn't transitive, so if a group contains another group, you have to run through all the children.
To search for the group and get its members at once, you can use the $filter and $expand query parameters:
https://graph.microsoft.com/v1.0/groups?$filter=mailNickname eq 'group1engineers'&$expand=members
The documentation contains information about which properties that can be $filter'ed. Look for the text "Supports $filter" in the property descriptions.
Upvotes: 2