Forms region settings to display form in explorer preview AND inspector

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

Forms region settings to display form in explorer preview AND inspector
 
Niels Ziegler


Guest


I am trying to display some information from the mail header in a custom form. It is currently displayed in the inspector window in the "TopSubpane" region when in "read" mode. This means it is shown above the sender information.

I would also like to display it in the mail preview area of the item explorer. I can not find a combination of settings. Is this supported and if yes, how do I have to configure the form?

Here is a screenshot if you can open the link:

https://1drv.ms/i/s!AuQ5KaHYGg6LiZ95d6MjeLN-UGaaDQ
Posted 19 Jun, 2017 06:12:05 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Niels,

You can show a pane in the TopReadingPane layout. There's no way to customize the area of the Preview Pane window where the Reply, Replay All, and Forward commands are located.


Andrei Smolin
Add-in Express Team Leader
Posted 19 Jun, 2017 07:11:30 Top
Niels Ziegler


Guest


Maybe I did not explain correctly what I was trying to achive, but I managed it by setting my form properties to:

ExplorerItemTypes: Mail
ExplorerLayout: TopReadingPane

InspectorLayout: TopSubpane
InspectorItemTypes: Mail


But here's another twist to my problem: I am trying to show "FORM A" when reading mail and "FORM B" when composing mail. This is easy in inspector mode, by setting InspectorMode to Compose / Read. But there is no such setting for the explorer. E-Mails in the folder Draft seem to be in "Read" mode, even though there is a "Send" button.

I need to show "Form B" in the explorer view when the mail is in draft "mode", and that should be independent of it's folder location (maybe it is not in the draft folder).

Can you please give some guidance on how I could identify items in draft mode? I guess if I had that information, I could hide the form during load.
I was unable to find any "received" information on Appointments for example, the same for tasks.
Posted 22 Jun, 2017 02:52:01 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Niels,

To prevent an ADXOlForm from being shown in a window, you set ADXOlForm.Visible=false in the ADXOlForm.ADXBeforeFromShow event. If you have two ADXOlFromCollectionItems creating FormA and FormB in inspector windows, you use the approach above to show this or that form and prevent the other one from showing.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2017 03:13:36 Top
Niels Ziegler


Guest


I know how to change visibility, but I need to identify the item state (read/compose) for different item classes in explorer mode.
Posted 22 Jun, 2017 03:19:04 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
The list of items in the Explorer window only shows items to read. I suppose you are talking about the inline response item. If so, check the Explorer.ActiveInlineResponse property (see https://msdn.microsoft.com/VBA/Outlook-VBA/articles/explorer-activeinlineresponse-property-outlook) to find if the Reading Pane is showing an item being composed.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2017 04:39:41 Top
Niels Ziegler


Guest


I am currently using the ADXSelectionChange event on the form I want to show/hide. ActiveInlineResponse is always null when changing between folders, even if the first item is in draft mode, unless I click explicitly on the current mail item.

I tried to do it like this:

 private void CheckInlineResponse()
        {
            Explorer explorer = (Explorer)this.ExplorerObj;

            bool hide = false;

            if (explorer != null)
            {
                if (explorer.ActiveInlineResponse != null)
                {
                    hide = false;

                    MailItem item = explorer.ActiveInlineResponse as MailItem;
                    if (item.Sent)
                    {
                        hide = true;
                    }
                    Marshal.ReleaseComObject(item);
                }
            }
            if (hide)
            {
                this.Hide();
            }
        }
Posted 22 Jun, 2017 04:59:58 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Niels,

The only item that you could describe as "being composed in the Outlook Explorer window" is the one opened in the reading pane. This item is returned via Explorer.ActiveInlineResponse. This item is different from the item returned via Selection.Item(1); the latter is always in the read mode.

Explorer.ActiveInlineResponse returns null if there's no item being composed.

When the inline response is shown, you get the Explorer.InlineResponse event. There's also Explorer.InlineResponseClose event.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2017 06:24:37 Top
Niels Ziegler


Guest


I still have trouble showing the correct form. I am trying to hide the forms during the ExplorerInlineResponse event.



 if (adxFormsManager.Items.Count > 0 && adxFormsManager.Items[0].FormInstanceCount > 0)
            {
                object activeWindow = OutlookApp.ActiveWindow();

                if (activeWindow != null)
                {
                    IntPtr hwnd = AddinModule.CurrentInstance.GetOutlookWindowHandle(activeWindow);
                    ClassificationForm classForm = FindForm(hwnd);

                    OLInterop.MailItem item = itemObject as OLInterop.MailItem;

                    if (classForm != null)
                    {
                        if (!item.Sent)
                        {
                            classForm.Show();
                        }
                        else
                        {
                            classForm.Hide();
                        }
                    }

                    ClassificationInfo infoForm = FindInfoForm(hwnd);

                    if (infoForm != null)
                    {

                        infoForm.Hide();

                    }

                    Marshal.Release(hwnd);
                    Marshal.ReleaseComObject(item);
                }
            }


I have to browse the folder at least a second time before the form visible settings are as expected. This is the only place I am trying to modify the form visibility, so the default settings from the module designer must be interfering with this event.

Here's another picture to show what happens:
https://1drv.ms/i/s!AuQ5KaHYGg6LiaABubJAMeIlZAG7vA
Posted 22 Jun, 2017 09:23:30 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Niels,

The code looking for a form may work incorrectly. Add-in Express forms are built on top of the Outlook windowing, not on top of the Outlook object model. This means an Outlook event may occur before or after Add-in Express detects a change in Outlook windows to show/hide your form.

This is why we suggest writing your code basing on the events of the form, not on the events of the Outlook object model: you should decide whether to show a given form in the ADXOlForm.ADXBeforeFromShow event of that form.


Andrei Smolin
Add-in Express Team Leader
Posted 22 Jun, 2017 10:22:19 Top