我正在尝试将 Outlook 2010 vsto AddIn 迁移到 Outlook 2013。除了尝试添加上下文菜单的一个问题外,一切都很顺利。
当我在 Outlook 2010 中运行以下代码时,它会在菜单中添加一个“与 Gradwell 联系的电话”——Happy Days!
Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
AddHandler Application.ItemContextMenuDisplay, AddressOf Application_ItemContextMenuDisplay
End Sub
Sub Application_ItemContextMenuDisplay(ByVal CommandBar As Microsoft.Office.Core.CommandBar, ByVal Selection As Microsoft.Office.Interop.Outlook.Selection)
If Selection.Count = 1 Then
If Selection.Item(1).class = olContactclass Then
CallContactButton = CommandBar.Controls.Add(Office.MsoControlType.msoControlButton)
With CallContactButton
.BeginGroup = True
.Caption = "Call contact with Gradwell"
.Parameter = Selection.Item(1).EntryID
.FaceId = 17
End With
End If
End If
End Sub
但是,当我在 Outlook 2013 中运行代码时,菜单不会出现。
当我通过代码进行调试时,Sub Application_ItemContextMenuDisplay 甚至都不会触发。
谁能建议为什么这不起作用?
谢谢