Outlook add-in : programmatically perform an “advanced Find” on the “SelectNamesDialog” RRS feed

  • Question

  • 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.

    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 > 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.InitialAddressList = contactsAddrList;
    snd.AllowMultipleSelection = false;
    snd.ForceResolution = true;
    snd.ShowOnlyInitialAddressList = true;

    Wednesday, January 9, 2013 9:49 AM