Using Advanced Form Regions

Add-in Express™ Support Service
That's what is more important than anything else

Using Advanced Form Regions
I've looked through the documentation and I'm having difficulty figuring out exactly how to use them. 
Frank Maiolo




Posts: 15
Joined: 2010-05-24
I have an Application that uses a custom Message type "IPM.Note.SecureMessage" and I've created a form called "SendForm" and I have a button that says "Send Secure Message" in my command toolbar. This is supposed to open the "SendForm" and allow the user to fill out the information and then send the message (through our system, not an smtp or exchange server).

Here is a snippet of my code:
private void InitializeComponent()
{
...
...
this.adxOlFormsManager1 = new AddinExpress.OL.ADXOlFormsManager(this.components);
this.SendSecureMessageForm = new AddinExpress.OL.ADXOlFormsCollectionItem(this.components);
...
...
...
//
// adxSendSecureButton
//
this.adxSendSecureButton.Caption = "Secure Message";
this.adxSendSecureButton.ControlTag = "f7e7b289-b7b4-467b-8359-fe73647a430e";
this.adxSendSecureButton.Image = 0;
this.adxSendSecureButton.ImageList = this.imageList1;
this.adxSendSecureButton.ImageTransparentColor = System.Drawing.Color.Transparent;
this.adxSendSecureButton.St yle = AddinExpress.MSO.ADXMsoButtonStyle.adxMsoButtonIconAndCaption;
this.adxSendSecureButton.Temporary = true;
this.adxSendSecureButton.UpdateCounter = 12;
this.adxSendSecureButton.Visible = false;
this.adxSendSecureButton.Click += new AddinExpress.MSO.ADXClick_EventHandler(this.SecureMessageClicked);
...
...
...
// adxOlFormsManager1
//
this.adxOlFormsManager1.Items.Add(this.SendSecureMessageForm);
this.adxOlFormsManager1.Items.Add(this.ReceiveSecureMessageForm);
this.adxOlFormsManager1.SetOwner(this);
//
// SendSecureMessageForm
//
this.SendSecureMessageForm.ExplorerMessageClass = "IPM.Note.SecureMessage";
this.SendSecureMessageForm.FormClassName = "MyAddin1.SendForm";
this.SendSecureMessageForm.InspectorMessageClass = "IPM.Note.SecureMessage";
this.SendSecureMessageForm.InspectorMode = AddinExpress.OL.ADXOlInspectorMode.Compose;

...
...
...
}

I've tried to do a SendForm s = new SendForm(); s.show(); and that blew up on me. I've also tried to create a new mailItem and Display that as follows:

private void SecureMessageClicked(object sender)
{
Outlook.MailItem j = (Outlook.MailItem)secureInbox.Items.Add(@"IPM.Note.SecureMessage");
j.Display(false);
}

That just shows the default Mailitem explorer.

I think I'm missing something fundamental here and I cannot seem to find anything that shows exactly how to do something like this with Addin Express.

Thanks,
Frank
Posted 24 May, 2010 17:28:28 Top
Frank Maiolo




Posts: 15
Joined: 2010-05-24
i was able to get it to show up by setting the InspectorLayout to BottomSubpane. Now I can still see the default mail item explorer as well. With the 2007 Outlook Form Regions you can replace that. Is that possible with Addin Express advanced form regions? BTW, i need to support outlook 2003 and 2007.

Thanks,
Frank
Posted 25 May, 2010 08:09:49 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
Hello Frank,

If you need to show ADXOlForm in Explorer, then you can use the WebViewPane Explorer layout to replace the standard folder view.
In an Inspector, you can try to use the InspectorRegion InspectorLayout.

Also see the Advanced Outlook Regions HOWTOs
Posted 25 May, 2010 11:35:22 Top
Frank Maiolo




Posts: 15
Joined: 2010-05-24
In the Inspector I set the InspectorLayout to InspectorRegion. What i get is the default Mail Form with my form behind it and accessible via that arrow. What I want to do is completely replace the default form. I can't see where I can do that.

In the Explorer, when I set ExplorerLayout to WebViewPane, my form takes up the whole view. I still want a list of items, but with my form at the bottom in the ReadingPane. When I set it to ReadingPane, I get nothing. If I use BottomReadingPane, I get it but I have a slider with the default reading pane in it. I want to replace these forms with my own and I don't want to see the defaults. Is this possible with Addin Express?
Posted 25 May, 2010 12:39:58 Top
Frank Maiolo




Posts: 15
Joined: 2010-05-24
Any suggestions here?
Posted 26 May, 2010 08:56:40 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
In the Inspector I set the InspectorLayout to InspectorRegion. What i get is the default Mail Form with my form behind it and accessible via that arrow. What I want to do is completely replace the default form. I can't see where I can do that.


Please see the following topic: Replacing inspector form

In the Explorer, when I set ExplorerLayout to WebViewPane, my form takes up the whole view. I still want a list of items, but with my form at the bottom in the ReadingPane. When I set it to ReadingPane, I get nothing. If I use BottomReadingPane, I get it but I have a slider with the default reading pane in it. I want to replace these forms with my own and I don't want to see the defaults. Is this possible with Addin Express?


When you use the ReadingPane ExplorerLayout and want to show your form at the top, you can call the Activate method in the ADXOlForm.ADXAfterFormShow event. But the user will be able to show the standard ReadingPane view by clicking on the arrow.


private void ADXOlForm1_ADXAfterFormShow()
{
    Activate();
}


User added an image

User added an image

If the ReadingPane layout does not work for you, please, let me know which version of Add-in Express and Office you use.
Posted 27 May, 2010 06:07:30 Top
Frank Maiolo




Posts: 15
Joined: 2010-05-24
Thanks Fedor,

After looking around the forum I figured out how to use the OutlookItemEventsClass to intercept the ProcessOpen call. So I am now able to bring up my own form by using e.Cancel = true.

in AddinModule.cs:
private void adxOutlookEvents_InspectorActivate(object sender, object inspector, string folderName)
{
Inspector i = inspector as Inspector;
Object o = i.CurrentItem;
if(o is MailItem)
{
MailItem m = o as MailItem;
if(m.MessageClass.Equals("IPM.Note.SecureMessage"))
{
eventObject.ConnectTo(i.CurrentItem, true);
}
}
}

in OutlookItemsEventsClass1.cs:
public override void ProcessOpen(AddinExpress.MSO.ADXCancelEventArgs e)
{
e.Cancel = true;
MailItem m = this.ItemObj as MailItem;
ReceiveMessageForm r = new ReceiveMessageForm(m);
r.show();
}

is the above correct? It seems to work for me. Since I use eventObject.ConnectTo(i.CurrentItem, true), I don't think I need to release any COM objects, do I?

I will play with the ReadingPane and let you know how that works.

Thanks,
Frank
Posted 27 May, 2010 07:29:03 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
Hi Frank,

InspectorActivate is raised after an item is opened, so
you need to use the adxOutlookEvents_ExplorerSelectionChange event instead of InspectorActivate.

You don't need to release the item when you use the "true" parameter in the eventObject.ConnectTo method.
Change your calling of the ConnectTo method to eventObject.ConnectTo(o, true), i.e. 'o' instead of 'i.CurrentItem'.

Also please see the following article:
When to release COM objects when developing Office add-ins in .NET
Posted 31 May, 2010 06:48:39 Top
Frank Maiolo




Posts: 15
Joined: 2010-05-24
Thanks Fedor,

I have this part of the code working as I was wanting. I'm able to cancel the event and the default inspector isn't opened and my custom dialog is. However, I would like to have a "Recipients" textbox with the autocomplete of the email addresses. I played with the Autocomplete of the TextBox class, but it doesn't seem to work in the same manner as the Recipients Text Box that the default Outlook Inspector uses. Any suggestions?

Thanks again,
Frank
Posted 31 May, 2010 22:37:51 Top
Dmitry Kostochko


Add-in Express team


Posts: 2841
Joined: 2004-04-05
Hi Frank,

The System.Windows.Forms.TextBox control and the Recipients text box control in Outlook are two different controls and naturally they both have their own behavior. I am afraid the .NET Framework doesn't have a control that can exactly replicate the Outlook Recipients text box.
Posted 01 Jun, 2010 05:00:39 Top