Filter Emails That Do Not Have An Assigned Category Using Graph API

Bryce Mowat 25 Reputation points
2024-03-11T04:53:01.68+00:00

Hello, I am fairly new to using Graph API.

Currently, I am using Power Automate to triage emails landing in a shared mailbox, to move them to specific subfolders for actioning.

Occasionally, an email will need to be moved back to the inbox. However, before being moved back to the inbox, these emails will be categorized for specific employees to action.

To prevent the automation rule from running again on previously processed emails, I want to set up a HTTP GET request that filters only those emails in the inbox that do not have an assigned category. How would I do this?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,491 questions
Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
4,867 questions
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 36,571 Reputation points
    2024-03-11T07:38:04.2266667+00:00

    Hi @Bryce Mowat

    You can retrieve messages without any categories by filtering the categories attribute. You can also use the $count query parameter to count the set of messages returned.

    GET https://graph.microsoft.com/v1.0/me/messages?$filter=not categories/any()&$count=true
    

    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.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful