Unable to filter using advance query capabilities in Microsoft Graph SDK for .Net

Wajahat Ali Khalid 25 Reputation points
2023-11-02T12:04:26.8666667+00:00

I'm Using Microsoft Graph SDK for .Net and GraphServiceClient to retrieve the list of users but cannot apply a filter on the user property 'employeeType'. I keep getting the error 'Unsupported or invalid query filter clause specified for property 'employeeType' of resource 'User'.

result = await graphClient.Users.GetAsync(requestConfiguration =>
                {
                    requestConfiguration.QueryParameters.Filter = "employeeType eq 'Employee'";
                    requestConfiguration.QueryParameters.Count = true;
                    requestConfiguration.Headers.Add("ConsistencyLevel", "eventual");
                });

This is how I'm trying to query. Employee Type property supports advanced query capabilities as documented by Microsoft. Still, I keep getting 400 exception with the message 'Unsupported or invalid query filter clause specified for property 'employeeType' of resource 'User'.

Windows for business Windows Client for IT Pros Directory services Active Directory
Developer technologies .NET Other
Microsoft Security Microsoft Graph
0 comments No comments
{count} vote

Accepted answer
  1. CarlZhao-MSFT 46,371 Reputation points
    2023-11-03T07:06:36.5466667+00:00

    Hi @Wajahat Ali Khalid

    I tested your code snippet and it works fine for me. Can you share more context? Have you tested the API in Postman or Graph Explorer and does it work?

    User's image

    Hope this helps.

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


0 additional answers

Sort by: Most helpful

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.