我在写VSTO插件添加一个按钮的标准工具栏的所有新MailItems在Outlook 2003

我知道了基本完成,但我看不到工作,如何设置任务栏上的按钮的位置 - 理想情况下,我想将它旁边的Send按钮

下面是代码我到目前为止。

Private Sub colInsp_NewInspector(ByVal Inspector As Microsoft.Office.Interop.Outlook.Inspector) Handles colInsp.NewInspector
    Dim msg As Outlook.MailItem
    Dim commandBar As Office.CommandBar
    Dim encryptButton As Office.CommandBarButton
    Dim olkitem As Object
    olkitem = Me.ActiveInspector().CurrentItem

    If TypeOf Inspector.CurrentItem Is Outlook.MailItem Then
        msg = CType(Inspector.CurrentItem, Outlook.MailItem)
        commandBar = Inspector.CommandBars("Standard")
        encryptButton = commandBar.FindControl(Tag:="EncryptMail")
        If Not (encryptButton Is Nothing) Then
            encryptButton.Delete()
        End If
        encryptButton = CType(commandBar.Controls.Add(1), Office.CommandBarButton)
        encryptButton.Style = Office.MsoButtonStyle.msoButtonIconAndCaption
        encryptButton.FaceId = 718
        encryptButton.Caption = "Secure Email"
        encryptButton.Tag = "EncryptMail"
        If olkitem.Sensitivity = Outlook.OlSensitivity.olConfidential Then
            encryptButton.State = Office.MsoButtonState.msoButtonDown
        End If
        AddHandler encryptButton.Click, AddressOf encryptButton_Click
        msg = Nothing
    End If
End Sub

任何帮助,将极大地理解!

谢谢, 吉姆。

有帮助吗?

解决方案

我应该使用的commandBar.AddControl(control, position)语法代替

其他提示

在Outlook 2007:

(Office.CommandBarButton)commandBars["Standard"].Controls.Add(Office.MsoControlType.msoControlButton, System.Reflection.Missing.Value, System.Reflection.Missing.Value,2,true);

其中2是位置的数目。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top