0

I have a winforms application which works perfectly in my x64 Win 7 dev environment but I cannot get the Outlook feature to work at all on the x86 XP machine, I keep getting this error when I try to open up a new Outlook mail with the address/subject line pre-filled in from the application side.

enter image description here

This only started happening since adding the reference to: Microsoft.Office.Interop.Outlook

This is the code used to create a new mail:

private void CreateOutlookEmail(string addresses)
        {
            Outlook.Application outlookApp = new Outlook.Application();
            Outlook.MailItem mailItem = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
            mailItem.Subject = "";
            mailItem.To = addresses;
            mailItem.Body = "";
            mailItem.Display(false);
        }

I have been searching the forums for an answer but no luck thus far. Here is what I have tried without success:

  • Set the platform target to x86 in project properties in VS2010
  • Install the OWC11 binaries.
  • Install all windows updates on the win XP machine.

Must I install other packs on the XP machine?

4

1 回答 1

1

您需要在系统上安装主互操作程序集。这会在您的开发系统上自动发生,因为它们是随 VisualStudio 一起安装的。其他系统不一定会安装它们。

更好的是,您可能应该使用安装程序进行部署- 这将为您处理依赖关系。


如何:安装 Office 主互操作程序集 (MSDN)

Microsoft Office 2010:可再发行主互操作程序集(下载)

2007 Microsoft Office System 更新:可再发行主互操作程序集(下载)

Office 2003 更新:可再发行主互操作程序集(下载)

另请参阅: 如何:为 Office 运行时可再发行组件 (MSDN) 安装 Visual Studio 工具


于 2013-06-10T09:48:54.213 回答