How to query outlook contacts by phone number?

Mediafields Web Development 6 Reputation points
2022-06-06T17:20:42.227+00:00

I'm trying to create an intergration with outlook contacts using the microsoft graph api, when i try and query contacts by phone number with:

https://graph.microsoft.com/v1.0/me/contacts?$filter=businessPhones/any(n:n eq '02079460121') 

I get an error 'The query filter contains one or more invalid nodes.'. I can't figuire out from the documentation why this query isn't working.

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

2 answers

Sort by: Most helpful
  1. Sheena-MSFT 1,731 Reputation points
    2022-06-07T08:47:27.217+00:00

    Hi @Mediafields Web Development ,

    For this user-list-contacts API you can use $filter, any, and the eq operator on only the address sub-property of instances in an emailAddresses collection.

    You can use the $filter query parameter to filter contacts based on their email addresses.

    Refere this more details on the $filter query for /contact Graph API.

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


  2. MichaelAebi-5118 5 Reputation points
    2023-02-21T10:12:08.61+00:00

    I made a feature request for this, please vote for it. Thanks.

    https://feedbackportal.microsoft.com/feedback/idea/786fb645-cfb1-ed11-a81b-000d3a0450e3

    0 comments No comments