我有业务要求从Office 365组织中提取组成员资格,并使用Microsoft Graph API解析每个组的所有成员。
我可以成功提取组列表并向下钻取组成员,但是目前Microsoft Graph API不会返回组成员,这些组成员是'联系人' - 它只返回用户(Microsoft.Graph.User
)和组(Microsoft.Graph.Group
)。
当前方法:
/v1.0/groups
)/v1.0/groups/{id}/members
)理想情况下,我需要知道使用Microsoft Graph是否可行,或者是否有其他API可用于实现业务需求。我考虑过的一种方法是拉取所有联系人,然后根据组列表评估该联系人以计算成员资格但不幸的是,似乎没有使用Microsoft Graph(只有用户特定的呼叫)拉取所有组织联系人的呼叫< / p>
示例JSON(v1.0/groups/165d8e8d-6ba0-4782-9dbc-251f6f76826d/members
):
{
"@odata.context":"${hidden}",
"@odata.nextLink":"${hidden}",
"value": [
{
"@odata.type": "#microsoft.graph.user",
"id": "b01eb2fe-1656-4c3e-a1bd-283c057baaac",
"businessPhones": [
"${hidden}"
],
"displayName": "${hidden}",
"givenName": "Richard",
"jobTitle": null,
"mail": "${hidden}@${hidden}",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": "en-NZ",
"surname": "${hidden}",
"userPrincipalName": "${hidden}@${hidden}"
},
{
"@odata.type": "#microsoft.graph.user",
"id": "802670e3-02d9-4083-be58-55ab7abef0ab",
"businessPhones": [],
"displayName": "Johnny Minty",
"givenName": "Johnny",
"jobTitle": null,
"mail": "johnny.minty@${hidden}",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": "en",
"surname": "Minty",
"userPrincipalName": "johnny.minty@${hidden}"
},
{
"@odata.type": "#microsoft.graph.user",
"id": "6d7a6dba-ddad-4351-b324-d88e575c50e1",
"businessPhones": [],
"displayName": "${hidden}",
"givenName": "Shrey",
"jobTitle": null,
"mail": "${hidden}@${hidden}",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": "en",
"surname": "${hidden}",
"userPrincipalName": "${hidden}@${hidden}"
},
{
"@odata.type": "#microsoft.graph.group",
"id": "9ad40d3c-ee89-4dd3-a511-a4c16691d695",
"deletedDateTime": null,
"classification": null,
"createdDateTime": "2017-08-09T07:08:14Z",
"description": null,
"displayName": "Large1",
"groupTypes": [],
"mail": "large1@${hidden}",
"mailEnabled": true,
"mailNickname": "Large1",
"onPremisesLastSyncDateTime": null,
"onPremisesProvisioningErrors": [],
"onPremisesSecurityIdentifier": null,
"onPremisesSyncEnabled": null,
"proxyAddresses": [
"SMTP:large1@${hidden}"
],
"renewedDateTime": "2017-08-09T07:08:14Z",
"securityEnabled": false,
"visibility": null
}
]
}
答案 0 :(得分:1)
Microsoft Graph目前仅支持Office 365,动态和安全组。您在此处查看的是经典的分发列表(有关详细信息,请参阅Compare groups)。
您没有获得完整列表的原因是Microsoft Graph没有Contact
对象的类型支持,它目前仅支持microsoft.graph.user
。
/beta
端点包括microsoft.graph.user
和microsoft.graph.orgContact
对象类型。如果您针对/beta
端点尝试呼叫,则会发现它会返回完整的成员列表。
我没有ETA,但只要Organization Contacts发布给GA,您就应该能够通过API利用分发列表。在此之前,您可以针对/beta
端点进行开发。您可能会在发布时进行一些小的更改,但最终版本不太可能会有很大的不同。