C# 在发送电子邮件时,通过vsto加载项在Office 2007中使用c调用拼写检查

C# 在发送电子邮件时,通过vsto加载项在Office 2007中使用c调用拼写检查,c#,outlook,C#,Outlook,我添加了两个按钮,用于发送和复制电子邮件,以及将电子邮件从outlook发送和移动到位于Sharepoint中的文档管理系统。我有两个按钮,但outlook中的自动拼写检查没有被调用。在以编程方式发送电子邮件之前,是否有方法调用outlooks 2007拼写检查 下面是一段代码片段 enter code here void Application_ItemContextMenuDisplay(Microsoft.Office.Core.CommandBar CommandBar, Micros

我添加了两个按钮,用于发送和复制电子邮件,以及将电子邮件从outlook发送和移动到位于Sharepoint中的文档管理系统。我有两个按钮,但outlook中的自动拼写检查没有被调用。在以编程方式发送电子邮件之前,是否有方法调用outlooks 2007拼写检查

下面是一段代码片段

enter code here

void Application_ItemContextMenuDisplay(Microsoft.Office.Core.CommandBar CommandBar, Microsoft.Office.Interop.Outlook.Selection Selection)
    {
      try
        {
        CommandBar.Controls[1].BeginGroup = true; // add seperator before first menu
            if (Selection.Count == 1)
            {
                _mailItem = Selection[1] as Outlook.MailItem;

                if (_mailItem != null)
                {
          Office.CommandBarButton cmdButtonCopy = (Office.CommandBarButton)CommandBar.Controls.Add(Office.MsoControlType.msoControlButton, 1, Missing.Value, 1, Missing.Value);
                    cmdButtonCopy.Caption = "&Copy to DMS";
                    cmdButtonCopy.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(cmdButtonCopy_Click);

                    Office.CommandBarButton cmdButtonMove = (Office.CommandBarButton)CommandBar.Controls.Add(Office.MsoControlType.msoControlButton, Missing.Value, Missing.Value, 2, Missing.Value);
                    cmdButtonMove.Caption = "&Move to DMS";
                    cmdButtonMove.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(cmdButtonMove_Click);                           


                }
            }
        }
        catch (Exception ex)
        {
            ExceptionService.Instance.Handle(ex.Message, ex);
        }
    }

    void cmdButtonCopy_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
    {
        try
        { 

           **// would  like to invoke spell check here......**
           Outlook.
            Utils.SendToDMS(_mailItem, false);





        }
        catch (Exception ex)
        {
            ExceptionService.Instance.Handle(ex.Message, ex);
        }
    }

我认为你做不到。据我所知,除了点击通过事件发送物品外,强制进行拼写检查的唯一方法是在工具栏上的拼写检查按钮上触发execute


Marcus

我发现有效的方法是以编程方式按下Alt+S,这与单击send按钮相同

mailItem.GetInspector.Activate();
System.Windows.Forms.SendKeys.SendWait("%S");