Date Filter in Outlook

Hi All,

I am trying to find a way to filter the outlook in such a way I can use subject, sender, and date via variables.

I am getting the following but it isn’t working:

“@SQL=urn:schemas:httpmail:subject LIKE '%” +variable.ToString + “%’”

Appreciate the help :slight_smile: :beers:


@Shubham_Varshney You can use the Get Outlook Mail Messages without a Filter to get the number of mails required. Then you can use a Query in an assign Activity to Keep only the mails that match your requirement in the following way :

mailMessages = mailMessages.Where(Function(x)x.Headers(“Date”).ToString.Contains(“yourDateValue”) and x.Subject.Equals(“yourSubjectValue”) and x.Sender.ToString.Contains(“yourSenderEmailValue”)).ToList

Where mailMessages is the Output of Get Outlook Mail Messages.

Note : The Date format it follows is probably “MM/dd/yyyy HH:mm:ss”. You should provide your value accordingly.


Yup this can be used, but I am looking specifically for the outlook filter property query!!!

1 Like

@Shubham_Varshney Can you provide the Filter conditions ?

Hi @supermanPunch

I am looking for the SQL query or the simple filter query that can be applied directly to “Get Outlook mails

This is very fast as it retrieves what’s required :slight_smile:

I am trying to merge date, subject, received from and etc in this together!!!


@Shubham_Varshney The below Filter seems to have worked for me :
Please check it and revert back if found any error.

"@SQL=(""urn:schemas:httpmail:subject"" like '%"&SubjectVar &"%') AND ("""" like '%"&SenderMailVar &"%') AND (""urn:schemas:httpmail:datereceived"" >= '07/19/2020 00:00:00')"

SubjectVar and the SenderMailVar are the variables that contain the values needed.
I have tried using a Like Operator on DateReceived but It didn not work. So I have kept it in the format it is supposed to accept as the mails have “MM/dd/yyyy HH:mm:ss” format.


we did shift to the " & Chr(34) & … approach last night
now help on handling the date is needed

thanks for support

1 Like

@ppr Can I look at that query ?

How exactly a date handling is needed :sweat_smile:

lets wait for @Shubham_Varshney for more details. We worked some parts to progress and he gave me feedback on needed date handling


I am trying to use it in code in a while… Will update you bot soon :slight_smile:

1 Like

@ppr @supermanPunch

The char(4) was creating a problem for me, so I tried @supermanPunch query it worked fine but I got stuck with the senders email issue…

@Shubham_Varshney What kind of issue ?

it’s not fetching on the basis of the email id at all

char(4) is becoming a bit complicated to apprehend, still trying that as well

@Shubham_Varshney Are you using a complete sender mail ID or a part of the mail id ?

char(4)? was meant Chr(34)?

lol damn!!!

Let me try that!!!

@ppr any clue on the filter for senders email ?

completely using it!!!
That is

@Shubham_Varshney I have tried with Completely using the mail Id, It worked for me. So you’re assigning to a variable and using it or directly using it, If you have not check by directly using it, can you check once ?
Also does it give an error or there won’t be no mails received ?Also make sure the date is set right.

It reverts back with 0 mail found!!!

@Shubham_Varshney Can you maybe send a Screenshot of the complete query that you have used in the filter?