Show Ribbon-Tab only in Main-Window (Outlook Addin)

Feb 17, 2015 at 9:57 AM
Dear together

I've successfully developed a Outlook Addin with NetOffice (nearby a great piece of software..). Now the Ribbon is always visible also inside new messages etc.

Is there a way to display the Ribbon only on the Main Window and not inside elements like calendar entries or memos?

I've played arround with the getVisible possibility inside the RibbonUI.xml and was able to hide the ribbon but could not figured out how to determine if the current "Window/Form" (whatever) is the Main Window or a new Message etc..

Does anyone have a input for me, where to serach or probably has a solution for my kind of question?

Thanks for your inputs.

regards
yves
Coordinator
Feb 17, 2015 at 12:27 PM
In NetOffice Tools you have to override the GetCustomUI method and check given argument.
For example:
    public override string GetCustomUI(string RibbonID)
    {
         if(String.IsNullOrEmptyWhiteSpace(RibbonID))
         {
              // empty means main window as far i known...
             return GetMyXMLSchema();
         }
         else if(RibbonID == "Microsoft.Outlook.Mail.Compose")
         {
              // create new mail window
             return GetMyXMLSchema();
         }
    }
check all possible ribbon id's here:
https://msdn.microsoft.com/de-de/library/office/ff868522.aspx

Sebastian
Feb 18, 2015 at 11:24 AM
Hi Sebastian

You brought me to the right path!

At the end I solved it a bit different:
Public Function getVisible(ByVal control As Office.IRibbonControl) As Boolean
        Try
            Dim objOutlook As Outlook._Application
            Dim myInspector As Outlook.Inspector
            objOutlook = New Outlook.Application()
            myInspector = objOutlook.ActiveInspector

            'Show only if TypeName is nothing (Outlook Main Window)
            If TypeName(myInspector) = "Nothing" Then
                Return True
            Else
                Return False
            End If

        Catch ex As Exception
            MsgBox(ex.Message, vbCritical)
            Return False
        End Try
    End Function