Microsoft Graph API - list users based on the given emails is not returning all the users

Piyush Kumar 0 Reputation points
2023-03-08T08:58:41.2633333+00:00

We are using this Graph API to fetch users based on the given email addresses. But in some cases the API is not returning all the matching users.

For Ex

Request

Fetch users based on email  [ abc@example.com, xyz@example.com ] 

 value:[
  {
    abc@example.com
  }
 ]
}

It's not returning xyz@example.com even though it's part of that organisation. What can be the possible reasons for this.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,526 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Gopinath Chennamadhavuni 2,431 Reputation points
    2023-03-08T13:32:35.6433333+00:00

    Hi Piyush Kumar,

    Thanks for reaching out.

    I am unable to reproduce this issue from my tenant. Using the Graph API: GET /users/?$search="mail:{mail-ID1}" OR "mail:{mail-ID2}"&$count=true with request header ConsitencyLevel: eventual I am getting the expected results.

    This request header and $count are required when using $search, or in specific usage of $filter. For more information about the use of ConsistencyLevel and $count, see Advanced query capabilities on Azure AD directory objects.

    Please refer the link for more details: https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http

    search_users

    Please check your Graph API execution with above provided details and if still you are facing the same issue and as mentioned by you, this issue is not happening in all the cases. I would recommend you to raise a support case with Microsoft Graph, a Support Engineer will be able to assist you better. You can raise support ticket from http://aad.portal.azure.com/ or https://admin.microsoft.com/#/support/requests.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments