cancel
Showing results for 
Search instead for 
Did you mean: 

Graph API - Outlook -- Search Emails By Subject ?

spalkar1
Level 3
Hi,
 I have used BP graph API developer exchange product to read/retrieve a list of all emails. Is there a way that I can filter ? ( I can and am filtering the result).. But is there a way to request a list of messages with specific query criteria ?
 Like give me a list of emails where the subject = " Get XYZ Report now" 
or emails that were received on a specific date = ?

 Any pointers/documents links will be helpful
1 REPLY 1

ewilson
Staff
Staff
Hello @spalkar1,

The Microsoft Graph API supports the use OData queries within the requests. There is an query parameter/tag you can apply to the URL called $filter​ that provides a means for entering a search criteria.

See this Microsoft page for further details: https://docs.microsoft.com/en-us/graph/query-parameters

NOTE: You will need to edit the definition of the Outlook connector to be able to leverage this. Here's an example of adding a $filter to the List Messages action such that it will only return messages received from j.doe@gmail.com. Notice I added the following extra data to the end of the URL Path:
?$filter=from/emailAddress/address eq 'j.doe@gmail.com'​

36912.png
If you wanted this to be configurable, you could add a new input parameter where you would specify the OData value of the filter.

Cheers,
Eric