Inconsistent results when filtering members from a Teams Group chat using Graph API

Michael Brown 0 Reputation points
2023-09-25T18:21:37.21+00:00

Hi,

I am trying to retrieve the chat id of a group, containing multiple members (i.e, memebers x , y and Z)

When using the graph api query, sometimes I receive a response back, and sometimes the response is null.

The behavior is very intermittent.

Here is a sample of the query that I am running:

https://graph.microsoft.com/v1.0/users/serviceAccountMember/chats?$expand=members&$filter=chatType eq 'group' and members/any(p:p/microsoft.graph.aadUserConversationMember/email eq 'memberA@mycompany.com') and members/any(p:p/microsoft.graph.aadUserConversationMember/email eq 'memberB@mycompany.com') and members/any(p:p/microsoft.graph.aadUserConversationMember/email eq 'serviceAccountMember@mycompany.com')

Any ideas of what could be happening?

Can the query be optimized better, or is this kind of expected behavior with Graph API?

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,977 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,870 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,207 questions
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 41,286 Reputation points
    2023-09-27T09:02:35.73+00:00

    Hi @Michael Brown

    Thanks for sharing your solution, it seems that including $top=50 in the query is the root cause of this issue.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.