Email displays blank when MailItem.HTMLBody is accessed for reading.

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

Email displays blank when MailItem.HTMLBody is accessed for reading.
Email displays blank when MailItem.HTMLBody is accessed for reading. 
TheNewCOMAddin Dev


Guest


Hi,

I am working on a ADX Outlook Addin what Uses Formmanager and displays a form completely replacing the email content.
I am using the following code to access the email content in the code which I use later to display the same in my form webbrowser control.

Problem: On certain machines we see the content seen is bank even though we have hidden this form.
if we remove this line
string mailBody = mailItem.HTMLBody;
Content displays on those machines, we tried multiple things but just access of MailItem.HTMLBody simply displays the email blank. Note that we are *not* changing any content just accessing it.

 
        private void ExplorerReadingPaneForm_ADXNewInspector(object sender, ADXNewInspectorEventArgs args)
        {         
            this.Hide();

            DebugWriteLine("inside ExplorerReadingPaneForm_ADXNewInspector");
            Outlook.Inspector Inspector = (Outlook.Inspector)InspectorObj;
            Outlook.MailItem mailItem = (Outlook.MailItem)Inspector.CurrentItem;
            string mailBody = mailItem.HTMLBody; // If I do this email goes blank, even reply show it as blank

            // Business logic to process mailData 
            // if criteria met this.Show();

            if (mailFolder != null) Marshal.ReleaseComObject(mailFolder);
            if (mailItem != null) Marshal.ReleaseComObject(mailItem);
        }


The form has multiple elements including webbrowser component that displays. But it should not have mattered as the form is hidden in case conditions are not met (default)
I am just stumped as to how this happens only on certain machine.
But on certain machines I am seeing the email empty.

[img]https://ibb.co/YNYWTHh[/img]
Posted 12 Mar, 2020 07:00:38 Top
Andrei Smolin


Add-in Express team


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

We look in this.


Andrei Smolin
Add-in Express Team Leader
Posted 12 Mar, 2020 07:35:47 Top
TheNewCOMAddin Dev


Guest


Hi ADXTeam,

- Do you have any inputs on this ? As the email is going blank in a new inspector with our addin this is a blocker for our clients.
- We have double checked, there is no other location where this content is overwritten as such.
- In fact right clicking and viewing source does show us the email source correctly!
- If we print the retrieved content HTMLBody we do see it as expected and its not empty.
- Another input though I am not sure is of interest is that the machines where this email is getting empty is having .Net 4.8. We on the other hand have .Net 4.7.2 on our machines and its working fine.

Thanks in advance for looking into this.

-Jatin
Posted 13 Mar, 2020 06:42:58 Top
Andrei Smolin


Add-in Express team


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

We are unable to reproduce the issue on our side. In a couple of minutes I'll send you a test project that you can modify so that the issue is reproducible.

Note that hiding the pane in the InspectorActivate event may not be really good idea: this is the moment when both Outlook and Add-in Express try to show something on the screen. Calling Hide may interfere with the logic behind the Outlook window and the pane being drawn. That logic is very complex with possible asynchronous calls (depending on how exactly the pane get drawn). Anyway, we suggest using the ADXOlFrom.ADXBeforeFormShow event to prevent the form from getting shown (instead of hiding it in the InspectorActivate event).


Andrei Smolin
Add-in Express Team Leader
Posted 13 Mar, 2020 08:01:26 Top