如何使用Microsoft Graph通过电子邮件地址查找组?

问题描述:

我正在使用图形浏览器来玩 Microsoft Graph .我了解您可以通过指定其ID来访问组,就像这样-

I'm using the Graph Explorer to play with the Microsoft Graph. I understand you can access a group by specifying its id, like so -

https://graph.microsoft.com/v1.0/groups/14481298-e121-4d97-91d5-3fe555aa2871

,您也可以像这样获得其成员-

and you can get its members as well like this -

https://graph.microsoft.com/v1.0/groups/14481298-e121-4d97-91d5-3fe555aa2871/members

但是我不清楚您如何通过群组的电子邮件地址查找群组并在一次通话中列出成员.我现在知道了,所以我想分享一下,还问是否有更好的方法.

But it isn't clear to me how you lookup a group by its email address and list the members in one call. I now know, so I thought I would share, and also ask if there is a better way.

要通过电子邮件获取组,可以按mail属性进行过滤.但是,这确实会返回一个数组,该数组与原始查询略有不同.

To get the group by email you can filter by the mail property. However this does return an array, which is slightly different from the original query.

https://graph.microsoft.com/v1.0/groups/?$filter=mail+eq+'sampleDL@example.com'

要获取成员,您可以扩展成员.

To get the members you can expand members.

https://graph.microsoft.com/v1.0/groups/?$filter=mail+eq+'sampleDL@example.com'&$expand=members