How To Set An Email Category In Power Automate

How To Set An Email Category In Power Automate

Power Automate can be used to set an email category. A category is an feature that allows you to tag, label and group messages. Emails also become easier to spot because a badge is displayed with the category name. There is no dedicated action for setting a category but it’s possible to do with the Outlook Send An HTTP action – which by the way does not require any premium licensing.

Table of Contents
• Introduction: The "Top Customer" Sales Email AutomationUpdate An Email Category Name In OutlookConfigure The "When A New Email Arrives" Trigger SettingsSet An Email Category Using The Microsoft Graph APIRun The Flow To Set The Email Category




Introduction: The “Top Customer” Sales Email Automation

Salespeople at a manufacturing company talk with their customers over email. When a new email is received from a “top customer” Power Automate applies a category to the email to make it easier for the salesperson to identify.



For example, “Top Customer” appears as badge for this new email from [email protected].




Update An Email Category Name In Outlook

Email categories are maintained in Outlook 365. There are several color coded preset categories by default. We want to update an existing category to read “Top Customer” instead.

Go to Outlook.com and right-click on any email in the inbox. Choose Categorize. Then select Manage Categories.



Change the name of one of the existing categories to “Top Customer” and close the menu.




Configure The “When A New Email Arrives” Trigger Settings

Open Power Automate and create a new automated flow using the Office 365 Outlook – When A New Email Arrives (V3) trigger. Choose the Folder named Inbox. Select an an account that can send an email to the inbox in the From field. This account will serve as a “Top Customer.”



Go to the trigger’s Settings and enable Split On. This tells Power Automate to evaluate each email individually as it arrives in the inbox.




Set An Email Category Using The Microsoft Graph API

We must use the Microsoft Graph API to set an email’s category since it does not appear as a standard action in Power Automate. Add an Office 365 Outlook – Send An HTTP Request action to the flow and select the PATCH method.



Use the following URI to update the message object.

https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages/@{triggerOutputs()?['body/id']}



Supply this JSON to the Body of the action.


{
"categories": ["Top Customer"]
}



Write this code in the Content-Type field.

application/json




Run The Flow To Set The Email Category

Now that our very simple flow is completed let’s try it out. Save the Power Automate flow in the editor and start a manual test. Then send a new email to the target inbox using the account we chose in the trigger’s From field.



The flow will completes successfully.



And a “Top Customer” badge shows within the email to display its’ category.





Questions?

If you have any questions or feedback about How To Set An Email Category In Power Automate please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Matthew Devaney

Subscribe
Notify of
guest

31 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Diego
Diego
9 months ago

Thank you for your great articles Matthew.

Have you found a way to read the categories from an email?

Damian Green
Damian Green
9 months ago

Is there a way to have Power Automate create a category when emails are sent out and then put it on those messages?

Jay
Jay
9 months ago

By chance, is there anyway to apply colour coding within the flow for the category badge? – so that if multiple categories are assigned, certain categories are different colours.

Enrico
Enrico
2 months ago

Can’t make It work… I Always get grey color tags, and also they are not saved in Outlook.
Anyone here found a way to do that?

harsha
harsha
9 months ago

can we have chance to remove category from email

raoul
raoul
8 months ago

Excellent – and now the other way around 🙂 When I manually set a label on an email, I want a flow to ask me to enter a date, set a reminder and set a follow up flag, so it appears in my todo.

I wonder how the trigger “when a label soandso, then..” is set.

Ingrid
Ingrid
1 month ago
Reply to  raoul

I second this request, How to set a trigger on a mailbox to do something with an existing mail after assigning a category to it

Shiv
Shiv
7 months ago

Thank you for your great blog, this is really helpful. I’m looking for the flow

  1. I have a share point list/ excel table containing unique string against each category name
  2. Unique string will be mapped to different category name (category will be created in outlook)
  3. Now I want to auto assign a category to Incoming emails having unique string in subject line.
Marti
Marti
5 months ago

Hi! I have just tried this method and I received an error message “The OData request is not supported.”. Do you have any idea what could be wrong? 🙁
Update: no worries, found the problem!

Last edited 5 months ago by Marti
Marti
Marti
5 months ago

I was not attentive enough, didn’t see that I chose the wrong method!

Neds
Neds
4 months ago

Is there a way to read those categories and export them (from, to, body, category) to a SharePoint list using power automate

Kunga
Kunga
4 months ago

Hi Matthew – How can i do the same for a shared mailbox instead of my personal mailbox?

Thank you for all of your articles!

Kunga
Kunga
4 months ago
Reply to  Kunga

Nevermind – I was able to find it out. I have attached a picture to showcase how it was configured.

1y.JPG
Enrico
Enrico
2 months ago
Reply to  Kunga

That’s great, thank you for posting.
Do you also know a way to change color to the category? I always get a grey category, no matter the category.
Another point, i can’t see the categories used in “category” menu (in outlook web, go to settings >>> general >>> Categories). I see only “Category <color>”.

Enrico
Enrico
2 months ago
Reply to  Kunga

Thanks to this i found my solution, thank you.

Stephen
Stephen
4 months ago

Thank you, how you would direct the folder to look a subfolder instead of the inbox? I have tried ‘Inbox\SUBFOLDER’ but this gives me an error?

Srini
Srini
4 months ago

How to get category from outlook using power automate. When new email received. Check category, once category updated capture category to excel

Scott
Scott
3 months ago

Hi, Matthew! Can the flow be modified to add a category to any existing category on the email–and not replace the existing category?

Scott
Scott
3 months ago
Reply to  Scott

Never mind. I have a flow that categorizes each email with the sender’s domain, and at first I thought each email in a conversation was overwriting the category. It’s not doing that–it’s adding a category with each new email.

Srini
Srini
3 months ago
Reply to  Scott

How to setup flow

Enrico
Enrico
2 months ago

Is there a way to control the color of each category? I can’t find a way to do that, even if categories are already there. All the categories are applied to mail, but always with grey color.

Abadah
Abadah
2 months ago

Hi Matthew ,

I tried to apply your way using GPT to generate dynamic categories but always getting HTTP request now working

I added all the details in Microsoft Forums for Power Automate

https://community.powerplatform.com/forums/thread/details/?threadid=ce9d5cb6-337f-ef11-ac21-6045bdd74f2e

image-20240930165537-8.png
AJS
AJS
1 month ago

Excellent, thanks!

Plamen Dimitrov
Plamen Dimitrov
1 month ago

Is any authentication required?

Sasitha
Sasitha
23 days ago

but need an authentication token for the shared mail boxes right?

Ajay
Ajay
26 days ago

can we remove category from email