Looking for elements in contacts RRS feed

  • Question

  • Hello,

    i have a userdefined ribbon in email and want to add a button that does the following after i have marked a word in the body of an email

    search for this word in all contacts and show the list of the hits.

    At the moment i do the following

    mark a word - press Strg+c change to contacts and search all elements paste and press enter.

    Any idea - its a bit complex i guess.

    thank you 


    Thursday, March 15, 2018 1:44 PM


  • Hello Krugi,

    You can use the AdvancedSearch method of the Application class which allows to perform a search based on a specified DAV Searching and Locating (DASL) search string.

    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).
     - You can stop the search process at any moment using the Stop method of the Search class.

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Thursday, March 15, 2018 3:30 PM