none
How to know search is completed in outlook? RRS feed

  • Question

  • Hi guys,

    I am currently implementing some functionalities by using Microsoft.Office.Interop.Outlook in C#.

    Currently, I am using  activeExplorer.Search(mailItem.Subject, OlSearchScope.olSearchScopeCurrentFolder) method and trying to add some logics after Search returns results.

    However, I am having some troubles to process searched items because it seems that search is a different thread and my code does not know when search is completed. Because of that, my code is sometimes throwing error because search is still in progress and next codes are trying to use the result of Search method.

    Is there anyway to check Search method is completed?

    Thank you so much!

    Tuesday, September 17, 2019 7:37 PM

All replies

  • The Application object's AdvancedSearch is run on a separate thread and the ApplicationEvents_11_Event.AdvancedSearchComplete event is fired when the search has completed.
    Tuesday, September 17, 2019 7:48 PM
  • Hi, this seems like only for AdvancedSearch.. does this work for Search as well?
    Wednesday, September 18, 2019 6:19 PM
  • Nope.  If you want notification that a search has completed then AdvancedSearch is the method to use.
    Wednesday, September 18, 2019 6:35 PM