Accessing a resource file in an Outlook VSTO Addin RRS feed

  • Question

  • I am new to VSTO development, so I will apologize upfront for any 'stupid' questions. I have done a bit of research and have found a lot of what I am looking for, just afraid I might not be asking the right question.

    I am building an AddIn, for Outlook, that when a user clicks "send" is going to look at all the recipients of the email and if there is any emails outside of a 'white' list or if they are trying to send the email to a public email domain (hotmail, gmail...) a pop-up box will come up and the user will have to verify that all the email addresses are correct.

    My question is:

    1. What is the best way to manage the "white" list (which would usually be the company email, any maybe any key partners)?
    2. What is the best way to manage the public email domain lists? 

    I was thinking to have a resource, or config file that can be modified as needed, without re-deploying the addin, and the addin code would read this resource file.

    So I can't figure our how to access a resource(s) file that will be used to get this information, and where is this resource file stored on the local computer?


    Thursday, July 9, 2015 12:05 AM


All replies

  • Hi David Christ,

    >>What is the best way to manage the "white" list (which would usually be the company email, any maybe any key partners)?<<

    It depends on the requirement. We can store the settings as a normal application in the config file or we can declare the variables in the code if it doesn't change.

    >>What is the best way to manage the public email domain lists? <<

    What did you mean public email domain lists? Based on my understanding, we can store the settings as mentioned
    above. Also we can store the settings in a database. If you don't want to re-deploy the add-in, we can also get the settings from web. For example, we can build a web service to provide settings, and every time add-in will read the settings from web when it starts up.

    Hope it is helpful.

    Regards & Fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 9, 2015 2:38 AM
  • Fei,

    Thank you very much for your response. I am guessing I should have been more clear. The "white" list is a list of email domains that I don't need the user to re-validate are ok. So as an example, if you worked for Microsoft and I installed this addon, I would add "Microsoft.COM", and maybe "MSFT.COM" to the white list, so if you sent an email to just people with those domains, I would not render a pop-up for you to validate you are sending information to the right people outside of your organization.

    Based on your suggestions, it looks like the config file would be the best place, as I don't want to hard-code it in the code. I also really like the suggestion of a web service, but that might be a 2.0 version.  

    Another question, can I create a resource file, or a separate file (outside of the config) that had this information, and that the program could read? If I where to create a "whitelist.txt" file? 

    Also, I am assuming as part of the installation of the addin, I could add an icon in the "ADD-INS"->"Custom Toolbars". If that is the case, I might be able to add the information in a pop-up when you select the icon. 

    Thanks again Fei, your insight was very helpful! 

    Thursday, July 9, 2015 11:09 AM
  • It is up to you which way is to choose for storing user settings (white or black lists of domains). I'd suggest asking common programming questions n the Visual C# forum instead. This forum is for Outlook related programming questions.

    Starting from Outlook 2007 (only inspectors) and 2010 command bars are not used any longer. You need to use the Ribbon Ui (aka Fluent UI) for customizing the UI. Take a look at the following articles in MSDN to get started:

    Walkthrough: Creating a Custom Tab by Using the Ribbon Designer

    Walkthrough: Creating a Custom Tab by Using Ribbon XML

    You can read more about the Ribbon UI in the following series of articles:

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)

    Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)

    Thursday, July 9, 2015 11:46 AM
  • Eugene,

    Thanks for all the links. Will read through these items and further my understanding. 

    Apologize for having these questions in this thread, as this was a VSTO for Outlook ADDIN I was creating, I wasn't sure if this would be the best community. 

    I noticed in my Outlook 2013, I am running (see picture below), that other "Add-INS" created icons in the "Custom Tool" bar under the ADD-INS tab. 

    Is it good practice to add any ADDIN icons/management screens into this area? and if so, would the articles you provided be applicable? 

    Thanks again Eugene for your further insight.

    Thursday, July 9, 2015 12:30 PM
  • Most probably these add-ins still use an old approach - command bars. All such customizations are displayed in Outlook on the Add-ins tab automatically which is not looks good.

    I'd suggest creating your own tab for add-in UI instead. Take a look at the following article in MSDN to get started:

    Walkthrough: Creating a Custom Tab by Using the Ribbon Designer

    Thursday, July 9, 2015 12:35 PM
  • Thanks for all your help!

    Last question, tell me if I should start a new thread.

    For this project, I am getting a list of all the recipients for an email, and then parsing that list to figure out if they are in the white or black list....

    The challenge is that I can do this mailItem.Recipients enumeration, but when I do this, I lose who is the mailItem.To, mailItemCC, mailItemBCC.

    Is there a way to convert a mailItem.To (which returns a string) back into a Recipient object? Or is there something in the Recipient object that defines the location of the recipient in the To/CC/BCC?

    I looked at the object inspector to find something, and hand no luck. I know you are really busy, and looking at other posts I have read, I see that you are answering TONS of questions for lots of people. 

    So thanks for any help, and if you are to busy, thank you anyways because you seem to be a strong resource in these threads.


    Thursday, July 9, 2015 1:13 PM
  • I'd recommend asking separate questions in new forum threads. Thus, forum readers may recognize questions and answers easily.
    Thursday, July 9, 2015 1:20 PM