是否有Microsoft Graph API列出组电子邮件中的用户,例如Outlook具有的功能?
如果此API存在,则在
上使用时group1engineers@example.com
它会列出
- jack@example.com
- tom@example.com
- rose@example.com
- etc.
更新1 :尝试了
GET /groups/group1engineers@example.com/members
on Graph Explorer(有访问Directory.ReadWrite.All)
但错误400
{
"error": {
"code": "Request_BadRequest",
"message": "Invalid object identifier 'group1engineers@example.com'.",
"innerError": {
"request-id": "dad057af-2b67-4186-bc8c-df2b10fc2d0c",
"date": "2018-02-02T09:53:51"
}
}
}
更新2 :尝试
GET /groups?$filter=mail eq 'group1engineers@example.com'
GET /groups?$filter=mailNickname eq 'group1engineers'
两者都得到相同的结果,仍然没有组成员出现(该组有7名成员):
{
"@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": "group1engineers@example.com",
"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:group1engineers@example.onmicrosoft.com",
"smtp:group1engineers@service.example.com",
"smtp:group1engineers@064d.mgd.example.com",
"SMTP:group1engineers@example.com"
],
"renewedDateTime": "2017-09-01T08:13:42Z",
"securityEnabled": false,
"visibility": null
}
]
}
答案 0 :(得分:2)
是的,您可以使用Graph API获取群组成员。来自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
请注意,它不具有传递性,因此如果某个群组包含其他群组,则必须让所有群组都能过滤。
要搜索群组并立即获取其成员,您可以使用$ filter和$ expand查询参数:
https://graph.microsoft.com/v1.0/groups?$filter=mailNickname eq 'group1engineers'&$expand=members
documentation包含有关哪些属性可以$ filter&ed; ed的信息。寻找文字"支持$ filter"在财产描述中。