title: Outlook add-in : programmatically perform an “advanced Find” on the “SelectNamesDialog”
body: <p>In my Outlook Add-In I’m bringing up the SelectNamesDialog to select a contact set on GAL. I would like to perform an Advance Find in order to look for Example for contact of a particular Company (See Screenshot).
  Do you know if this is something that is actually doable? Is there an interface I’m Missing? You can look at my code with some unsuccessful ties out.</p>
  
  <p><img src="https://i.stack.imgur.com/ohmGV.jpg" alt="enter image description here"></p>
  
  <pre><code>Outlook.SelectNamesDialog snd = Globals.ThisAddIn.Application.Session.GetSelectNamesDialog();
  
  Outlook.AddressList contactsAddrList = null;
  Outlook.AddressList gal = Globals.ThisAddIn.Application.Session.GetGlobalAddressList();
  
  String company = "My Company";
  
  // Try to look &gt; Dead code not working
  //Outlook.MAPIFolder galFolder = Globals.ThisAddIn.Application.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.);
  //String sScope = "SCOPE ('shallow traversal of " + (char)34 +  + (char)34 + "')";
  //String sFilter = (char)34 + "urn:content-classes:person" + (char)34 + " LIKE 'RE:%'";
  //Outlook.Search search = Globals.ThisAddIn.Application.AdvancedSearch(sScope, sFilter, false, company);
  //contactsAddrList = search.Save(company).;
  
  // Set InitialAddressList to Contacts folder AddressList.
  snd.SetDefaultDisplayMode(Outlook.OlDefaultSelectNamesDisplayMode.olDefaultSingleName);
  snd.InitialAddressList = contactsAddrList;
  snd.AllowMultipleSelection = false;
  snd.ForceResolution = true;
  snd.ShowOnlyInitialAddressList = true;
  snd.Display();
  </code></pre>