Various questions

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

Various questions
 
Laughing John


Guest


Hi,

As per my previous post I am attempting to recreate a VSTO addin using addin express, and I have the following questions:

1. In VSTO when you add a form region to an Email form it appears in both the Email Form and the preview pane. With addin express it seems to only add it to the email form. Can you tell me how I achieve adding it to both?
2. When I have a form region in the email form AND the preview pane - I want to be able to access the form region from a ribbon button (one on the inspector for the form and one on the explorer for the preview pane). Can you tell me how I get a reference to the form from a ribbon button event?
3. I want to be able to add some new folders to the inbox (I already have this code) but then I want the folder view to point to an addin express form only for the folders I have added. Can you tell me how I do this in code (i.e. not using the designer)?

Thanks,
LJ
Posted 16 Jan, 2014 06:40:48 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello LJ,

For the form to be shown up in an inspector window, you need to choose a value for the ADXOlFormsCollectionItem.InspectorLayout property.

To show the form in the explorer window, you need to set the ExplorerLayout property and also set either ExplorerItemTypes property or the FolderName/FolderNames property. That is, answering to #3, you need to add an ADXOlFormsCollectionItem at design time and specify the folders (actually folder paths) at startup. You may need to call ADXOlFormsCollectionItem.ApplyTo(explorer) after doing this.

To get an ADXOlFrom shown in a given Explorer or Inspector window, call ADXOlFormsCollectionItem.GetForm(object ExplorerOrInspectorObj).


Andrei Smolin
Add-in Express Team Leader
Posted 16 Jan, 2014 07:07:09 Top
Laughing John


Guest


Thanks Andrei,

That's very helpful.

I've managed to add my form region to the reading pane which works fine. However it look different to when it is displayed on the email form.

I have the form background set to white and the RegionBorder of the Form ADXOIFormCollectionItem set to FixedSingle. On the email form it does indeed have a border, but on the reading pane it doesn't which means my form gets blended into the email text. Also the form on the reading pane appears to have no margin around it while it does on the email form. Any thoughts?

Thanks,
LJ.
Posted 16 Jan, 2014 08:22:42 Top
Laughing John


Guest


Sorry, another question:

In my form I am getting the current email by using the ActiveInspector.CurrentItem. However when displayed on the preview pane the ActiveInspector is null. How do I get a pointer to the Email Item and how does my form know what context it is being displayed in?

Thanks again,
LJ
Posted 16 Jan, 2014 08:26:14 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello LJ,

Laughing John writes:
However it look different to when it is displayed on the email form.


What Outlook version, service pack and bitness do you have? Also, please copy here the settings of the corresponding ADXOlFormsCollectionItem.

Laughing John writes:
How do I get a pointer to the Email Item and how does my form know what context it is being displayed in?


See Explorer.Selection, the Selection.Item(1) (Selection[1] in C#). Please note that getting Explorer.Selection throws an exception when in some folders. An example of such folder would be RSS Feeds; actual folders depend on the Outlook version used. I recommend that you wrap this call in a try/catch block.


Andrei Smolin
Add-in Express Team Leader
Posted 16 Jan, 2014 08:37:22 Top
Laughing John


Guest


And yet another question:

I notice that when I first start Outlook the ADXBeforeFormShow event fires (twice, first without an email selected and then with the selected one). However when I move to another email the AdXBeforeFormShow event doesn't fire any more.

I'm using this event to fill in the details of the form, and it works for me when displaying in an Email Form, is the another event that fires when a different email is selected in the Explorer?
Posted 16 Jan, 2014 08:38:57 Top
Laughing John


Guest


Further to that, I tried using the ADXSelectionChange event of the form which does what I want, however as soon as I open an email the event stops firing for some reason...
Posted 16 Jan, 2014 08:51:52 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
To intercept SelectionChange in Explorer windows, you need to put an Outlook Events component onto the add-in module.

Using the ADXOlForm.ADXSelectionChange event on an inspector form doesn't make sense.


Andrei Smolin
Add-in Express Team Leader
Posted 16 Jan, 2014 08:55:22 Top
Laughing John


Guest


Sorry, just noticed your reply. Going back to that question I'm using OL2010 Version 14.0.7106.5003 (32 bit).

And the form collection looks like this:

// adxOlFormsCollectionItem1
//
this.adxOlFormsCollectionItem1.ExplorerItemTypes = AddinExpress.OL.ADXOlExplorerItemTypes.olMailItem;
this.adxOlFormsCollectionItem1.ExplorerLayout = AddinExpress.OL.ADXOlExplorerLayout.BottomReadingPane;
this.adxOlFormsCollectionItem1.FormClassName = "XXX_Outlook_AddinAI.EmailFormRegion";
this.adxOlFormsCollectionItem1.InspectorItemTypes = AddinExpress.OL.ADXOlInspectorItemTypes.olMail;
this.adxOlFormsCollectionItem1.InspectorLayout = AddinExpress.OL.ADXOlInspectorLayout.BottomSubpane;
this.adxOlFormsCollectionItem1.InspectorMode = AddinExpress.OL.ADXOlInspectorMode.Read;
Posted 16 Jan, 2014 08:56:46 Top
Laughing John


Guest


"Using the ADXOlForm.ADXSelectionChange event on an inspector form doesn't make sense. "

This is on the Explorer not the Inspector. I'm using the same form in 2 different places and I need to alter the contents both when an Email is opened in an Inspector and when the selection changes on the Explorer.

Originally I was setting up the fields on my form using the ADXBeforeFormShow event, but this didn't work in the Explorer. I've now changed it so that I subscribe to 2 events:

1. The ADXNewInspector event. I'm using this to set up the form when an email inspector is opened.
2. The ADXSelectionChange event. I was hoping to use this to update my form (in the preview pane) when the selection changes in the Explorer.

When I open outlook and change the selected email the ADXSelectionChange event fires quite happily and I can set up my form correctly for each selected email. However if I open and close an Email Inspector, come back to the Explorer and change the selected email the ADXSelectionChange event no longer fires.
Posted 16 Jan, 2014 08:58:24 Top