展望互操作性 [英] Outlook interoperability
问题描述
当我宣布,
Microsoft.Office.Interop.Excel.ApplicationClass excel =
new Microsoft.Office.Interop.Excel.ApplicationClass();
我收到错误,因为
I receive errors as
微软.Office.Interop.Outlook.ApplicationClass无法嵌入。使用适用的接口来代替。
'Microsoft.Office.Interop.Outlook.ApplicationClass' cannot be embedded. Use the applicable interface instead.
和
该型'Microsoft.Office.Interop.Outlook.ApplicationClass有没有构造函数定义
The type 'Microsoft.Office.Interop.Outlook.ApplicationClass' has no constructors defined
如何解决?
推荐答案
无论是使用该接口:
Microsoft.Office.Interop.Outlook.Application outlook = new Microsoft.Office.Interop.Outlook.Application()
或此程序互操作类型的停用嵌入(参考 - > Microsoft.Office.Interop.Outlook (右键) - >属性 - >设置嵌入互操作类型设置为False)
or disable embedding of Interop types for this assembly (References -> Microsoft.Office.Interop.Outlook (right click) -> Properties -> Set 'Embed Interop Types' to False)
上的为什么的可以在这里找到更多信息:的 http://blogs.msdn.com/b/mshneer/archive/2009/12/07/interop-type-xxx-cannot-be-embedded-use-the-applicable-interface-instead.aspx 。
More info on the why can be found here: http://blogs.msdn.com/b/mshneer/archive/2009/12/07/interop-type-xxx-cannot-be-embedded-use-the-applicable-interface-instead.aspx.
这篇关于展望互操作性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!