开发者

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) 开发者_如何学Gothat 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.


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.


figured this out, After I built my form I just had to add these lines

CMSConnectorControl formMain = new CMSConnectorControl();
formMain.ShowDialog();

to the ThisAddin_Startup() function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜