Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you open a form or window in an Outlook Addin (VSTO)

I am new to VSTO programming. I have created a basic addin for Outlook 2007 that monitors a folder containing XML text files which it opens and then sends them as an email, then deletes them. this all works fine.

I want the user to be able to configure certain settings for the way the addin/program will operate, such as the folder that it will monitor, and other things. The logical way to do this is to create a menu item in the addin (which I have also done) that opens a windows form (or XAML window) that allows them to enter the parameters.

In my addin I added a new item Windows Form, which worked, and the designer opened. However, in my addin code I cannot open the form. The Show() method normally associated with form objects is not available.

Is this simply something you cannot do, or am I just doing it the wrong way?

I have read about Outlook form regions, but these seemed to be attached to outlook items such as a new email, task, appointment etc... there doesnt seem to be a way to create a form region that can be opened in the main window of Outlook.

Ideally, I would like to go with my original method of opening a new window from a menu item, but if this isnt possible I would like to hear other solutions.

Thanks, Will.

like image 343
dontpanic Avatar asked Jun 08 '10 01:06

dontpanic


1 Answers

For a normal form, it sounds like you didn't just add System.Windows.Forms as a reference, create the object then show it eg.

Form myFrm = new frmFlightList();
myFrm.Show();

This should work in a VSTO addin, as it does in any other form. The CMSConnectorControl object you refer to is a distraction to others for the general case of just wanting to display a form.

like image 133
Pete Avatar answered Oct 21 '22 23:10

Pete