Office365 使用Microsoft Graph来扩展DL,可以在扩展$后使用$select来减少响应大小吗?
我正在尝试查找通讯组列表中的所有成员,因为它是电子邮件地址。假设我有Office365 使用Microsoft Graph来扩展DL,可以在扩展$后使用$select来减少响应大小吗?,office365,office365api,microsoft-graph-api,Office365,Office365api,Microsoft Graph Api,我正在尝试查找通讯组列表中的所有成员,因为它是电子邮件地址。假设我有sampleDL@example.com并且要扩展其成员,只返回displayName和userPrincipalName,我可以这样做吗 我正在使用,以我自己的身份登录。在查询框中,我可以使用$filter和$expand- https://graph.microsoft.com/v1.0/groups/?$filter=mail+eq+'sampleDL@example.com'&$expand=members 但
sampleDL@example.com
并且要扩展其成员,只返回displayName
和userPrincipalName
,我可以这样做吗
我正在使用,以我自己的身份登录。在查询框中,我可以使用$filter和$expand-
https://graph.microsoft.com/v1.0/groups/?$filter=mail+eq+'sampleDL@example.com'&$expand=members
但响应是巨大的,已经将每个成员扩展到其完整的属性集。我只想包括displayName
和userPrincipalName
。我想可以用$select
-
https://graph.microsoft.com/v1.0/groups/?$filter=mail+eq+'sampleDL@example.com'&$expand=members($select=displayName,userPrincipalName)
但这样做会返回一个错误-
{
"error": {
"code": "Request_BadRequest",
"message": "Term 'members($select=displayName,userPrincipalName)' is not valid in a $select or $expand expression.",
"innerError": {
"request-id": "02f3471c-9e93-4bcc-8b7f-dffd187cd33a",
"date": "2016-05-13T23:04:00"
}
}
}
这可能吗?我走对了吗?select语句是否错误,因为返回的输出是数组
这可能吗?我走对了吗?select语句是否错误,因为返回的输出是数组
理论上,可以通过以下方式实现:
https://graph.microsoft.com/v1.0/groups/?$filter=mail+eq+'email@domain.onmicrosoft.com'&$expand=members$select=members/displayName
但正如我测试的那样,组API不支持“多导航属性”
顺便说一句,group对象中members属性的类型是directory object collection,这意味着members中的项可以是从directory对象继承的任何类型的对象(例如,用户或组),但“displayName”和“userPrincipalName”除外是在micrsoft.graph.user对象中定义的。很好的一点是,并非所有对象都具有这些属性-一个本身是另一个通讯组列表的对象不会具有UPN。您找到了解决方案吗?