Listing O365 contacts using the Graph API that have a certain category assigned

Anton Koval 21 Reputation points
2023-10-04T22:04:12.4633333+00:00

Hello,

Some time ago, Outlook for Web introduced a switch "New Contacsts":

User's image

What it does (as it appears to me) is replace "Contact Folders" with "Contact Categories". With the switch off, I see only the contact folders that I created earlier:

User's image

There is an API method to list contacts in a folder https://learn.microsoft.com/en-us/graph/api/contactfolder-list-contacts?view=graph-rest-1.0&tabs=http. But what about listing contacts in a category? Making a request like

https://graph.microsoft.com/v1.0/contacts?$filter=categories/any(a:a eq 'fld1')

returns an error:

{
    "error": {
        "code": "Request_UnsupportedQuery",
        "message": "Unsupported or invalid query filter clause specified for property 'categories' of resource 'OrgContact'.",
        "innerError": {
            "date": "2023-10-04T22:02:30",
            "request-id": "baec4992-9926-42d4-b6f3-52c57a45a4f7",
            "client-request-id": "4703372b-4dd8-e829-ba6c-f3665081bddf"
        }
    }
}

Please advise.

Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Sourabh Gupta 800 Reputation points Microsoft External Staff
    2023-12-10T12:16:35.9033333+00:00

    Hi Anton Koval

    Could you please try to run the following query and see if your contacts are tagged to any categories. Would you mind sharing the response as well?

    https://graph.microsoft.com/v1.0/me/contacts?$select=categories

    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.