Search Since

Mar 23, 2014 at 4:41 PM
Hello.

may I kindly ask for an example of use search messages newer than an specified date?

I am specialy interested in date format in .NET.

Thank you very much
Miroslav
Coordinator
Mar 24, 2014 at 3:34 PM
Hi Miroslav,

this question already has been discussed here before, however the answer didn't contain the hints on how to format the date with standard .Net methods.

The dates being passed with IMAP SEARCH queries are always formatted as 1-Feb-1994 (dd-MMM-yyyy). To convert a DateTime object to string with the specified format, do the following:
client.Folders.Inbox.Search("SINCE " + dateTime.ToString("dd-MMM-yyyy", new CultureInfo("en-US")))
This works for all date specfic queries (e.g BEFORE etc.).

Greets,

Pavel
Mar 24, 2014 at 3:41 PM
Hi Pavel,
thanks a lot. That is exactly I needed.

Miroslav