Version 803 - Email Form Region Issue

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

Version 803 - Email Form Region Issue
GetForm Fails 
Laughing John




Posts: 38
Joined: 2009-05-19
Hi,

I just installed the latest release V803 and have noticed a problem/behavior change. I'm using Outlook 2010. I have a form region which is on the email form. In the explorer the region is shown or hidden in the preview pane based on the value of some custom MAPI properties.

Since installing the latest version I noticed that the form is always shown when I am looking at Sent Emails. Additionally when you do a search in the search bar and change to "All Mail Items" the form appears despite there being no Email to show.

I looked at my code and I have routine that handles the showing and hiding based on a number of events, including selection changed. While the events still fire as before my code uses GetForm() to get an instance of the form and in V803 this returns null. I regressed to V802 and it is working again.

The code looks like this:



            var form = adxOlFormsEmailForm.GetForm(explorerOrInspector) as EmailFormRegion;

            if (form != null)
            {
                var mailItem = OutlookHelper.GetMailItemFromExplorerOrInspector(explorerOrInspector); // RETURNS NULL ON SENT FOLDER

                if (mailItem == null)
                {
                    form.CancelExistingTasks();
                    form.Hide();
                }
                else
                {
                    form.SetupFormRegion(mailItem);
                }
            }
        }


The form is defined like this:

            this.adxOlFormsEmailForm.AlwaysShowHeader = true;
            this.adxOlFormsEmailForm.Cached = AddinExpress.OL.ADXOlCachingStrategy.OneInstanceForAllFolders;
            this.adxOlFormsEmailForm.ExplorerItemTypes = AddinExpress.OL.ADXOlExplorerItemTypes.olMailItem;
            this.adxOlFormsEmailForm.ExplorerLayout = AddinExpress.OL.ADXOlExplorerLayout.BottomReadingPane;
            this.adxOlFormsEmailForm.FormClassName = "MyCompany.EmailFormRegion";
            this.adxOlFormsEmailForm.InspectorItemTypes = AddinExpress.OL.ADXOlInspectorItemTypes.olMail;
            this.adxOlFormsEmailForm.InspectorLayout = AddinExpress.OL.ADXOlInspectorLayout.BottomSubpane;
            this.adxOlFormsEmailForm.InspectorMode = AddinExpress.OL.ADXOlInspectorMode.Read;
            this.adxOlFormsEmailForm.IsHiddenStateAllowed = false;

[/CODE]

The call to OutlookHelper.GetMailItemFromExplorerOrInspector(explorerOrInspector) always returns null on the Sent Folder. Because I can't get a reference to the form I can no longer hide it when appropriate.

For now I have reverted to the old version.

Thanks
LJ
Posted 03 Nov, 2016 06:46:03 Top
Andrei Smolin


Add-in Express team


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

I'm confused.

Compare

Laughing John writes:
The call to OutlookHelper.GetMailItemFromExplorerOrInspector(explorerOrInspector) always returns null on the Sent Folder.


and

Laughing John writes:
While the events still fire as before my code uses GetForm() to get an instance of the form and in V803 this returns null.


What code returns null? If GetForm(), we need to know to to reproduce this issue. If GetMailItemFromExplorerOrInspector(), you need to debug it.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Nov, 2016 07:10:03 Top
Laughing John




Posts: 38
Joined: 2009-05-19
Apologies Andrei, my bad description.

The line that's failing (returns null) is "var form = adxOlFormsEmailForm.GetForm(explorerOrInspector) as EmailFormRegion;"
Posted 03 Nov, 2016 10:26:47 Top
Laughing John




Posts: 38
Joined: 2009-05-19
Hi Andrei,

Bump! No rush, but just don't want this one to get lost as it would be a blocking issue for us on future upgrades.

Thanks
LJ
Posted 10 Nov, 2016 06:36:47 Top
Andrei Smolin


Add-in Express team


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

Thanks for reminding!

In what event do you call adxOlFormsEmailForm.GetForm()?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Nov, 2016 08:32:33 Top
Laughing John




Posts: 38
Joined: 2009-05-19
Hi Andrei,

This routine (the entire code of which is in the original post) is called from the Explorer Selection Changed Event. It's actually called from a few places, but selection changed is where it was failing (Sent Items folder).

Regards,
Nick.
Posted 15 Nov, 2016 07:05:52 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Nick,

We haven't been able to reproduce the issue. We suppose that since you control the visibility of your form, it is possible that GetForm returns null (Nothing in VB.NET) in the SelectionChange event. To solve this problem, or provide a working solution (workaround), we would need to have a project reproducing the issue. Would it be possible? If yes, please send such a project to the support email address. You can find it in {Add-in Express installation folder}\readme.txt. Please make sure your email contains a link to this topic.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 15 Nov, 2016 08:44:29 Top
Laughing John




Posts: 38
Joined: 2009-05-19
Hi Andrei,

I have sent a test project before and after the upgrade which demonstrates the issue.

Regards,
LJ.
Posted 15 Nov, 2016 12:20:08 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Nick,

Sorry for missing this. We've reproduce the issue and fixed it. The fix will be included in the build which is planned for tomorrow.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 16 Nov, 2016 09:14:10 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Nick,

We've published the new build. Check https://www.add-in-express.com/downloads/adxnet.php.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 17 Nov, 2016 03:54:34 Top