Outlook Read Message Tab disappearing entirely (sometimes)

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

Outlook Read Message Tab disappearing entirely (sometimes)
can't determine what causes this strange behavior 
aweber




Posts: 83
Joined: 2013-11-21
I created a ribbon group (VS2010) to be added to Outlook 2010 inspector's default "TabReadMessage" tab. AFAIK, this tab should be shown for ALL mail item inspectors (when the email is being read).

My ADXRibbonTab does, indeed show on the correct Outlook Inspectors, when that tab is shown at all. Since adding my custom tab (group), I can not determine what causes it, but during many startups of Outlook, the entire tab (the default tab on Outlook Inspector for reading Mail Items with the caption "Message") is missing! I do not enable/disable my controls within my ADXRibbonTab for this object dynamically. I do see the property-changing event being called for the Tab (I just log this and let it continue). It gets called usually once, the first time I launch an inspector. If Outlook is good-enough to show me the Message tab on the inspector, it will continue to do so for the entire session. If it decides (somehow, and the reason for this post) that the Message tab should not be shown for the inspector, it never shows it for the entire session (for any subsequent launches of mail items in inspectors).

The ADXRibbonTab has the following properties set:
Caption: Message
Controls: (Contains one ADXRibbonGroup with three buttons)
IdMso: TabReadMessage
Ribbons: OutlookMailRead

Does anyone have any ideas how to debug this? If I dump the properties of the ADXRibbonPropertyChangingEventArgs will it help? I would assume these are consistent.

I can not determine how to consistently recreate this. I only know that it occurs a lot, and if the tab is missing the first time you launch a mail-inspector, it will remain missing for the remainder of the session. If it appears correctly, then it will remain for the session. Using ADX v7.3.4061.

Thanks for any tips on how to troubleshoot this.

-AJ

EDIT: I find that if I use the "Next Item" and "Previous Item" buttons it actually does display the "Message Tab" for some items and not others AND, if I scroll up and down the items enough times, it will actually change the result for the same, individual mailitem. That is if the tab is missing, and I toggle through the items "enough", it may eventually show the tab when I come back to that same item. This is really strange, and given that I have only some logging code in the "Property Changing" of the custom group-items, it should be consistently shown. In fact, I can't believe Outlook is letting the default "Message tab" be not shown for reading mailitems -- ever.
Posted 03 Feb, 2014 16:24:44 Top
Andrei Smolin


Add-in Express team


Posts: 17430
Joined: 2006-05-11
Hello AJ,

This problem haunts us for quite a long time. We are unable to reproduce it and thus we unable to find a fix for it. We have a workaround however.

    Private Function ReplaceGetVisibleWithVisible(ByVal incomingXML As String, ByVal ribbonTab As ADXRibbonTab, Optional ByVal visible As Boolean = True) As String
        Dim result As String = String.Empty

        Dim lines As String() = incomingXML.Split(Environment.NewLine)

        For i As Integer = 0 To lines.Length - 1
            If (ribbonTab.IdMso <> String.Empty) Then
                If (lines(i).Contains("idMso=""" + ribbonTab.IdMso)) Then
                    lines(i) = lines(i).Replace("getVisible=""getVisible_Callback""", "visible=""" & visible.ToString().ToLower() + """")
                    Exit For
                End If
                'Else
                '    If (lines(i).Contains(ribbonTab.Id)) Then
                '        lines(i) = lines(i).Replace("getVisible=""getVisible_Callback""", "visible=""" + visible.ToString().ToLower() + """")
                '        Exit For
                '    End If
            End If
        Next

        For i As Integer = 0 To lines.Length - 1
            result += lines(i) + Environment.NewLine
        Next
        Return result
    End Function

    Private Sub AddinModule_OnRibbonBeforeLoad(ByVal sender As System.Object, ByVal e As AddinExpress.MSO.ADXRibbonBeforeLoadEventArgs) Handles MyBase.OnRibbonBeforeLoad
        e.Xml = ReplaceGetVisibleWithVisible(e.Xml, AdxRibbonTab1, True)
        e.Xml = ReplaceGetVisibleWithVisible(e.Xml, AdxRibbonTab2, True)
    End Sub


This code fragment replaces the getVisible attribute on a tab element having the specified idMso value with the visible attribute. That is, after applying this code, you will not be able to modify the visibility of that tab on the fly; anyway, this fixes the issue.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Feb, 2014 00:44:59 Top
aweber




Posts: 83
Joined: 2013-11-21
Thanks for assuring me that I was not entirely crazy. ;)

Can you please just clarify how to call the custom method (from the OnRibbonBeforeLoad)? Should I call ReplaceGetVisibleWithVisible() for only my "problem" custom RibbonTab (I have a second RibbonTab for the Outlook Explorer)? Or do I need to call this now for all of my ADXRibbonTab controls?

Does this work properly when we are adding a group to an existing/default/OOTB tab (as I would be passing a custom ADXRibbonTab, but that code is only a small portion of the actual tab's groups and controls)?

Thanks again,
AJ
Posted 04 Feb, 2014 07:40:21 Top
aweber




Posts: 83
Joined: 2013-11-21
BTW: If it helps you debug this long-time issue, I can let you webex onto my Virtual Machine where I have been easily able to reproduce this. I have the "Professional" version, so if you need your source code to step into, you'll have to "bring your own". ;)

But if you simply have a debug assembly or something that outputs a lot of debug logging, I can substitute that in for a few runs to send you the output.

PM me if you, or your team are interested.

-AJ
Posted 04 Feb, 2014 07:46:10 Top
Andrei Smolin


Add-in Express team


Posts: 17430
Joined: 2006-05-11
Hello AJ,

You need to call that method for all built-in Ribbon tabs (they have a non-empty string in their IdMso properties) which you don't need to show/hide at run time.

Thank you for the proposal. I'll send you an email about this in a couple of minutes.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Feb, 2014 09:23:41 Top