Aspose.email graphclient ODataQueryBuilder

Hi

I trying to filter the sent items of a mailbox where the Sent Date is greater than 01 Jul 2026 and the subject contains ‘Auto Reply:’ in mapi format but I’m not having much luck can you help?

Regards
Ian

Hello @IanTyrrell,

Thank you for bringing this to our attention.
Please allow us some time to investigate this issue. We will get back to you with an update as soon as we have more information.

Hi @IanTyrrell
You can use ODataQueryBuilder to construct query parameters that are sent to Microsoft Graph. Please note that ODataQueryBuilder is not an Aspose-specific query language; it is simply a convenient helper class for building Microsoft Graph requests with OData query parameters.

The complete list of supported query parameters and their limitations is documented by Microsoft:

You can get the desired result with Aspose.Email using the code below:

ITokenProvider provider = new AzureConfidentialTokenProvider(accessParameters.TenantId,
           accessParameters.ClientId, accessParameters.ClientSecret);
IGraphClient client = GraphClient.GetClient(provider, accessParameters.TenantId);

var folders = client.ListFolders();
string sentId = folders.Find(x => (x.DisplayName == "Sent")).ItemId;
           
var builder = new ODataQueryBuilder
{
   Filter = "sentDateTime ge 2026-07-01T00:00:00Z and contains(subject,'Auto Reply:')"
};

var filteredMessages = client.ListMessages(sentId, builder);