问题
Could anyone help me get the first tab idMso value of an opened Outlook item window? I need to dynamically set it in a ribbon xml file, since I figured out it would be redundant to add each item window into the xml code. If anyone has an existing solution to share, that would be great.
Thanks
回答1:
Solved it :)
Just edit the return string from the GetCustomUI on runtime, but trap the explorer item first
Public Function GetCustomUI(ByVal ribbonID As String) As String Implements Office.IRibbonExtensibility.GetCustomUI
Dim strResText As String = ""
Dim strGetRes As String = ""
Select Case ribbonID
Case "Microsoft.Outlook.Appointment"
strGetRes = GetResourceText("OutlookAddIn.Ribbon1.xml")
strResText = strGetRes.Replace("TabNewMailMessage", "TabAppointment") 'default value of it is TabNewMailMessage
Case Else
strResText = GetResourceText("OutlookAddIn.Ribbon1.xml")
End Select
Return strResText
End Function
Original XML string:
<tab id="customTab" label="myCustomTab" insertBeforeMso="TabNewMailMessage" visible="true">
New XML string on Appointment item window:
<tab id="customTab" label="myCustomTab" insertBeforeMso="TabAppointment" visible="true">
来源:https://stackoverflow.com/questions/12467937/outlook-2007-ribbon-customization-in-net-using-vs2010-insertbeforemso-dynamic