none
Implement Find a contact functionality in excel ribbon similar to that of outlook RRS feed

  • Question

  • Hi, we have a requirement in our project where in we need to implement the functionality in excel  similar to that of "Find a contact" in Outlook, since this is new , its been difficult to find which tools are being used in order to implement the search functionality, correct me if I am wrong but the box seems to be the edit box , but I am not sure on which tool does the list gets generated where the name,level and picture is displayed. It would be great if any one can help me with this. Thanks in Advance.

    Monday, September 24, 2012 8:35 AM

Answers

  • Use the VSTO ribbon designer to add whatever ribbon controls you want to Excel. That's the easiest way. Otherwise you could add any controls you want using ribbon XML.
     
    However, I don't think there are any ribbon controls that really do what the search box in Outlook does that are exposed for your use. You'll have to settle for what's available.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Utshek" <=?utf-8?B?VXRzaGVr?=> wrote in message news:87b6682b-2439-457d-9ea8-94c5dbab0c9f...

    Hi Ken Slovak,

    Jay, want to search some rows (can say some text) from provided Range/Sheet and want to display in similar way as “Search Contact” implemented in Outlook (with search box and its popup result set). We do not want implement this as Outlook add in, we want to implement this in Excel ribbon. If it is possible then how do we add custom control to Excel ribbon?

    Thanks


    Ken Slovak MVP - Outlook
    Wednesday, September 26, 2012 2:22 PM

All replies

  • All of that is done using MAPI table searches and internal controls not available to you. You would need to design your own search UI to show whatever you want to show. If you are actually searching Outlook contacts, a MAPI table search is the fastest way to go.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Jay Deliwala" <=?utf-8?B?SmF5IERlbGl3YWxh?=> wrote in message news:10646b1f-c42d-42d6-930c-73908d021963...

    Hi, we have a requirement in our project where in we need to implement the functionality in excel  similar to that of "Find a contact" in Outlook, since this is new , its been difficult to find which tools are being used in order to implement the search functionality, correct me if I am wrong but the box seems to be the edit box , but I am not sure on which tool does the list gets generated where the name,level and picture is displayed. It would be great if any one can help me with this. Thanks in Advance.


    Ken Slovak MVP - Outlook
    Monday, September 24, 2012 3:08 PM
  • Thank you for the information.  My requirement is as follows,

    I have certain set of cells which are in single name range on one of the worksheet, on navigating to other worksheet , there would similar control to that of "find a contact" in outlook on the ribbon of my excel sheet on which we should be able to seach in that particular name range. Any help or start up for the same would be of great help. TIA.

    Tuesday, September 25, 2012 7:25 AM
  • In the use case you outline I'd probably use the Outlook.Application.AdvancedSearch() method. That will return a Results collection which contains all items that match your search terms. You can set the search to start at the top of the store and to search subfolders, so it can search in any of your folders.
     
    What you have to decide is what property you want to search on, for example display name for your contacts.
     
    There are quite a few help examples for AdvancedSearch and for its terms such as Filter and Scope in the Outlook VBA project's Object Browser Help. The examples are in VBA code but can easily be converted into whatever language you're using in your VSTO addin.
     
    For Scope I'd supply a folder path to the parent of the Inbox folder like this c# snippet where olApp is your Outlook.Application reference:
     
    Outlook.NameSpace olNS = olApp.GetNameSpace("MAPI");
    Outlook.Folder inbox = olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
    Outlook.Folder topOfStore = inbox.Parent as Outlook.Folder;
    string parentPath = "'" + topOfStore.FolderPath + "'";
     
    For a filter on the display name I'd use something like this:
     
        string filter = "http://schemas.microsoft.com/mapi/proptag/0x3001001F" + " LIKE '%" + parm + "%'";
     
    where "parm" is the string value to search for. What looks like a URL is a DASL property tag for a Unicode display name, and the remainder of the filter uses SQL-like syntax to find any item where the value of "parm" is contained somewhere in the contact display name.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Jay Deliwala" <=?utf-8?B?SmF5IERlbGl3YWxh?=> wrote in message news:2442d560-5f6d-4c38-89a7-488fff3cba5b...

    Thank you for the information.  My requirement is as follows,

    I have certain set of cells which are in single name range on one of the worksheet, on navigating to other worksheet , there would similar control to that of "find a contact" in outlook on the ribbon of my excel sheet on which we should be able to seach in that particular name range. Any help or start up for the same would be of great help. TIA.


    Ken Slovak MVP - Outlook
    Tuesday, September 25, 2012 2:28 PM
  • Hi Ken Slovak,

    Jay, want to search some rows (can say some text) from provided Range/Sheet and want to display in similar way as “Search Contact” implemented in Outlook (with search box and its popup result set). We do not want implement this as Outlook add in, we want to implement this in Excel ribbon. If it is possible then how do we add custom control to Excel ribbon?

    Thanks

    Wednesday, September 26, 2012 9:20 AM
  • Use the VSTO ribbon designer to add whatever ribbon controls you want to Excel. That's the easiest way. Otherwise you could add any controls you want using ribbon XML.
     
    However, I don't think there are any ribbon controls that really do what the search box in Outlook does that are exposed for your use. You'll have to settle for what's available.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Utshek" <=?utf-8?B?VXRzaGVr?=> wrote in message news:87b6682b-2439-457d-9ea8-94c5dbab0c9f...

    Hi Ken Slovak,

    Jay, want to search some rows (can say some text) from provided Range/Sheet and want to display in similar way as “Search Contact” implemented in Outlook (with search box and its popup result set). We do not want implement this as Outlook add in, we want to implement this in Excel ribbon. If it is possible then how do we add custom control to Excel ribbon?

    Thanks


    Ken Slovak MVP - Outlook
    Wednesday, September 26, 2012 2:22 PM