2016-05-16 47 views
0

我試圖找到通訊組列表的所有成員,因爲它是電子郵件地址。假設我有[email protected]並想擴展其成員,只返回displayNameuserPrincipalName,我可以這樣做嗎?

我使用Microsoft Graph Explorer,以我自己的身份登錄。在查詢框,我可以用$過濾得到group and members和$擴展 -

https://graph.microsoft.com/v1.0/groups/?$filter=mail+eq+'[email protected]'&$expand=members 

但反應是巨大的,已經擴大了每個成員充分發揮其特性集。我只想包括displayNameuserPrincipalName。我想也許能瘦下來與$select響應 -

https://graph.microsoft.com/v1.0/groups/?$filter=mail+eq+'[email protected]'&$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語句是錯誤的,因爲返回的輸出是一個數組?

+0

你找到了解決方案嗎? – 2017-02-23 08:51:59

回答

1

這可能嗎?我在正確的軌道上嗎? select語句是錯誤的,因爲返回的輸出是一個數組?

從理論上說,它可以用做:

https://graph.microsoft.com/v1.0/groups/?$filter=mail+eq+'[email protected]'&$expand=members$select=members/displayName 

但正如我測試,本集團API不支持「多導航屬性」。

順便說一句,組對象中成員屬性的類型是目錄對象集合,這意味着成員中的項目可以是從目錄對象(例如,用戶或組)繼承的任何類型的對象,但「displayName」和「userPrincipalName」在micrsoft.graph.user對象中定義。

+0

不是所有的東西都有這些屬性 - 一個本身就是另一個分發列表的對象不會有UPN。 – LookingSharp

相關問題