Question

I want to use my own form region, design via VSTO 2010 and Outlook 2010. The type of the form region is "separate". I've a button in my ribbon bar automatically added by the form region. Also I've a own tab in ribbon bar, with a button to show the form region. The included code of the button click event is here:

Outlook.Inspector inspector = this.Context as Outlook.Inspector;
inspector.SetCurrentFormPage("OutlookAddIn.FormRegion1");

Now my problem is to hide the button, which is created automatically by the form region. I've also tried to use the type of "replace" or "replace-all" of the form regions. But the code bellows get me an exchaption, that the page does not exist.

I only want to have a own ribbon bar tab with a button, to show my form region in Outlook 2010.

Thanks for help!

Was it helpful?

Solution

I've searching one time more and found some information to replace the different form region types. First of all, there is no way to show only the form region without any button on the show region in ribbon bar.

Here are the different results to show "seperate", "adjoining", "replace" and "replace all" from a button click of your own button.

Seperate:

Outlook.Inspector inspector = this.Context as Outlook.Inspector;
inspector.SetCurrentFormPage("OutlookAddIn.FormRegion1");

Adjoining:

Only to add an form region of type adjoining to your project. 
Select the right MessageClass!

Replace and Replace all:

Outlook.NameSpace ns = Globals.ThisAddIn.Application.GetNamespace("MAPI");
Outlook.MAPIFolder mapi = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderNotes);

Outlook.MailItem miItem = (Outlook.MailItem)mapi.Items.Add("IPM.Note.YourName");
miItem.Display(true);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top