How to retrive outlook mails for specified date like ex: 25-10-2022 to 29-10-2022 and how to write expression for this?

How to retrive outlook mails for specified date like (fromdt) variable-(25-10-2022) to todt variable (29-10-2022) so how to write expression for this in outlook get mail?

Hi @sathish_Kumar6,

You can use this expression in filter part.

“receivedDateTime gt 2022-10-25 and receivedDateTime lt 2022-10-29”

You can check this topic too. Microsoft Office 365 - Get Mail Activity Queries to filter returned emails

Regards
Ă–mer

this error occurs when i used as normal expression or variable expression “receivedDateTime gt “+fromdt+” and receivedDateTime lt “+todt+”” but results are similiar errors

image

Hi,

FYI, Windows project accepts only " (0x22) as character which means String literal, at this time.
(Other double quote character will fail) Can you try to replace your double quote with "

Anyway, which activity do you use? If GetOutllokMailMessage, the following will work.

    "[Received] >= '" + fromdt.ToString("d") + " 00:00AM' AND [Received] <= '"+ todt.ToString("d") + " 00:00AM'"

If O365 get mail, the following will work.

"receivedDateTime ge "+fromdt.ToString("yyyy-MM-dd")+" and receivedDateTime le "+todt.ToString("yyyy-MM-dd")

Regards,

1 Like

Hey thanks for the detailed info @Yoichi
BUt idk why i cant write subject as i tested with this input date format like
2022-10-22 to fromdt and 2022-10-26

HI,

Can you elaborate your issue with screenshot etc.?

Regards,

1 Like

Actually it is my outlook problem yoichi once it is fixed will let u know any thanks for your continous support.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.