简体   繁体   English

Visual Studio的Outlook对象库

[英]Outlook Object Library for Visual Studio

Our office is running two different versions of MS Office (2007 and 2010). 我们的办公室运行两个不同版本的MS Office(2007年和2010年)。 Is there a way for me to integrate Outlook into a C# project and have it work for both versions of Outlook? 有没有办法让我将Outlook集成到C#项目中并让它适用于两个版本的Outlook? I have added a reference to Microsoft Outlook 14.0 Object Library, but for users of Outlook 2007, do they require version 12.0 or will the newer version work? 我添加了对Microsoft Outlook 14.0对象库的引用,但对于Outlook 2007的用户,它们是否需要12.0版本或新版本是否有效?

You should be able to use the primary interop assemblies. 您应该能够使用主互操作程序集。 Binding redirects are put in place so when you load an application that accesses the primary interop assemblies for 12.0 on a machine that has 14.0 installed, the 14.0 versions will be loaded. 绑定重定向已到位,因此当您在安装了14.0的计算机上加载访问12.0主互操作程序集的应用程序时,将加载14.0版本。 This should allow you to develop the same code and have it work for both 2007 and 2010 这应该允许您开发相同的代码,并使其适用于2007年和2010年

I've faced a similar problem recently. 我最近遇到了类似的问题。 The software would either work with 2007 or 2010. I fixed this by referencing the 2007 libraries (v12.0 as Slaks suggested) and in the properties of the reference I set "SpecificVersion" to false. 该软件可以使用2007或2010.我通过引用2007库(v12.0作为Slaks建议)修复此问题,并在引用的属性中将“SpecificVersion”设置为false。

After that it worked fine with 2007 and 2010 之后,它在2007年和2010年都运作良好

您可以使用2007(v12.0)库,它应该可以正常使用用户计算机上安装的任何版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM