1

I am trying to make a Get Request to the Microsoft Graph API for a specific user's email within my organization. Therefore, I have created the following query, to return the displayName, scoredEmailAddresses, and userPrincipalName for user "jane doe", whose userPrincipalName endsWith @something.com (see below). However, when I run this query in Graph Explorer, I receive the error below. Can any advise how I can fix this query?

QUERY:

https://graph.microsoft.com/v1.0/me/people?$search="Jane Doe"&$select=displayName,scoredEmailAddresses,userPrincipalName&$count=true&$filter=endsWith(userPrincipalName, '@something.com')

ERROR:

{
      "error": {
          "code": "ErrorInvalidUrlQueryFilter",
          "message": "The query filter contains one or more invalid nodes.",
          "innerError": {
              "date": "2022-07-26T14:16:45",
            }
       }
  }
tlockhart
  • 381
  • 2
  • 7

2 Answers2

0

It looks like that userPrincipalName does not support filtering.

If I try the simple filter query

https://graph.microsoft.com/v1.0/me/people?$filter=userPrincipalName eq 'john.doe@something.com'

The response returns an error

{
    "error": {
        "code": "ErrorInvalidProperty",
        "message": "The property 'UserPrincipalName' does not support filtering.",
        "innerError": {
            "date": "2022-07-27T09:45:45",
            "request-id": "9500af61-d1a9-4c9b-b405-05f9c07c81f1",
            "client-request-id": "a0bda440-4f9b-aa4a-5d6c-4a0271bda023"
        }
    }
}
user2250152
  • 14,658
  • 4
  • 33
  • 57
0

If you can directly search the user by following below API , why you are

enter image description here

vicky kumar
  • 563
  • 3
  • 11