How to retrieve uncategorized emails using Microsoft Graph API

Ravindra Shukla 116 Reputation points
2021-05-12T11:35:37.323+00:00

Hi,

I am using Microsoft Graph to retrieve the emails from the mailboxes, I know how to get the emails based on categories using below query.

https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=categories/any(c:c eq 'Yellow category')

However I want to retrieve all the emails or count of all the emails which don't have any categories assigned. I tried using the above query in other way as

https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=categories/any(c:c ne 'Yellow category')

and also like as below, but its not working.

https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=categories/any()

How can I achieve this?

Any help or pointers are appreciated.

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

2 answers

Sort by: Most helpful
  1. Danstan Onyango 3,821 Reputation points Microsoft Employee
    2021-05-13T13:33:07.92+00:00

    As far as I know, this capability is currently not supported via MS Graph API. I have created this GitHub Issue that may help provide details of whether this is possible and how to achieve it.


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    8 deleted comments

    Comments have been turned off. Learn more

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.