“I’d like to get all emails with a specific topic keyword, can I use Power Automate to search in the email text?”
When you need to get emails from a mailbox, the ‘Get emails’ action gives you a lot of options. You can filter by the subject, sender, recipient, CC, etc., but what about the email text? There’s no field that would explicitly ask you for a keyword. How do you search in the email body then?
Use HTTP request instead of ‘Get emails’
The first thing I’d recommend is to not use the ‘Get emails’ action. That action will return maximum 25 emails, no matter how many there’re. Since there can be more than 25 emails it’s better to use the Office 365 Groups action ‘Send an HTTP request’ without such limitation.
Once you add the action you can easily define the filter directly in the url. For example, if I want to search for all emails with the word ‘nordic’ in the body, I can just add the parameters &search=”body:nordic”.
https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages?$select=sender,subject,body&top=100&search="body:nordic"
To decompose the search parameter into pieces:
& - adding another parameter in the url
search - to search for something
= - what to search for?
body - search where
: - search for
nordic - the actual value to search for
Put it all together and it’ll return only emails with the word ‘nordic’ in the text.
Note: you can also search in from, subject, and body at the same time if you skip the ‘search where/for’ in the url, e.g. &search=”nordic”.
Summary
As you can see, you can quite easily search in the email text using Power Automate flow. Instead of the default action use an HTTP request and add the parameter to the url. It’ll return more than 25 emails and you can even search in from, subject, and body at the same time.
And it’s not limited to email body, there’s a whole bunch of values you can search for as specified in the Microsoft documentation.