none
What time on an email is searched by the filter ""urn:schemas:httpmail:date" >= '6/10/2014 1:12:21 PM'" RRS feed

  • Question

  • An additional (very dumb!) question:

    We have an Outlook Add-in where we need to search for "new" emails ... those that have been received (or sent) after the last search.  I'm currently using the following for a filter:

    ""urn:schemas:httpmail:date" >= '6/10/2014 1:12:21 PM'"

    where the time shown in the example is the time of the last email previously checked (oMail.SentOn for sent items, ReceivedTime for those that have been received) converted to UTC.  

    What property on the emails being searched does that "urn:schemas:httpmail:date" look at?  Is it CreationTime, LastModificationTime, or something else?

    mdpowers

    Tuesday, June 10, 2014 10:53 PM

Answers

  • Hello,

    There are three main ways for searching Outlook items using the Outlook object model:

    1. Find/FindNext methods of the Items class - see How To: Use Find and FindNext methods to retrieve Outlook mail items from a folder (C#, VB.NET)

    2. Restrict method of the Items class - see How To: Use Restrict method to retrieve Outlook mail items from a folder

    3. The AdvancedSearch method - Advanced search in Outlook programmatically: C#, VB.NET

    The key benefits of using the AdvancedSearch method in Outlook are:

    • The search is performed in another thread. You don’t need to run another thread manually since the AdvancedSearch method runs it automatically in the background.
    • Possibility to search for any item types: mail, appointment, calendar, notes etc. in any location, i.e. beyond the scope of a certain folder. The Restrict and Find/FindNext methods can be applied to a particular Items collection (see the Items property of the Folder class in Outlook).
    • Full support for DASL queries (custom properties can be used for searching too). You can read more about this in the Filtering article in MSDN. To improve the search performance, Instant Search keywords can be used if Instant Search is enabled for the store (see the IsInstantSearchEnabled property of the Store class).
    • Finally, you can stop the search process at any moment using the Stop method of the Search class.

    • Marked as answer by mdpowers-slo Wednesday, June 11, 2014 9:37 PM
    Wednesday, June 11, 2014 12:16 PM

All replies

  • As far as I know, it is PR_CLIENT_SUBMIT_TIME in MAPI (which is MailItem.SentOn in Outlook Object Model).


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, June 11, 2014 12:56 AM
  • OK, that explains why some emails do not get checked ... if there was any delay in the delivery, something would arrive but get missed by the filter.

    What would be the proper syntax for doing an advanced search to find all received emails with the received time greater than the specified time? And would there be a way to have the query look for MailItem.SentOn >= LastCheckTime OR MailItem.ReceivedTime >= LastCheckTime???


    mdpowers

    Wednesday, June 11, 2014 3:35 AM
  • Hello,

    There are three main ways for searching Outlook items using the Outlook object model:

    1. Find/FindNext methods of the Items class - see How To: Use Find and FindNext methods to retrieve Outlook mail items from a folder (C#, VB.NET)

    2. Restrict method of the Items class - see How To: Use Restrict method to retrieve Outlook mail items from a folder

    3. The AdvancedSearch method - Advanced search in Outlook programmatically: C#, VB.NET

    The key benefits of using the AdvancedSearch method in Outlook are:

    • The search is performed in another thread. You don’t need to run another thread manually since the AdvancedSearch method runs it automatically in the background.
    • Possibility to search for any item types: mail, appointment, calendar, notes etc. in any location, i.e. beyond the scope of a certain folder. The Restrict and Find/FindNext methods can be applied to a particular Items collection (see the Items property of the Folder class in Outlook).
    • Full support for DASL queries (custom properties can be used for searching too). You can read more about this in the Filtering article in MSDN. To improve the search performance, Instant Search keywords can be used if Instant Search is enabled for the store (see the IsInstantSearchEnabled property of the Store class).
    • Finally, you can stop the search process at any moment using the Stop method of the Search class.

    • Marked as answer by mdpowers-slo Wednesday, June 11, 2014 9:37 PM
    Wednesday, June 11, 2014 12:16 PM