.NET/Outlook互操作和保存附件:一个神秘的例外 [英] .NET / Outlook interop and saving attachments: a mysterious exception
问题描述
这是来自.NET新手的有关.NET/Outlook互操作的问题.我正在使用C#和MS Visual Studio 2008,MS Outlook 2003和Xobni(不确定是否相关).
异常详细信息和代码如下.
未处理System.InvalidCastException
Message ="无法将类型为'System .__ ComObject'的COM对象转换为接口类型'Microsoft.Office.Interop.Outlook .MailItem".此操作失败,因为具有以下错误的IID为"{00063034-0000-0000-C000-000000000046}"的COM组件上的COM组件上的QueryInterface调用由于以下错误而失败:不支持此类接口(HRESULT的异常:0x80004002(E_NOINTERFACE)) ."
源=" OLInteropTest"
StackTrace:
at OLInteropTest.Program.Main(String [] args)in t:\ Models \ psinis \ OReillyExamples \ OLInteropTest \ OLInteropTest \ Program.cs:line 20
System.AppDomain._nExecuteAssembly(Assembly assembly,String [] args) 中的
在System.Threading.ThreadHelper.ThreadStart_Context(对象状态)
位于System.Threading.ExecutionContext.Run(ExecutionContext执行上下文,ContextCallback回调,对象状态)
在System.Threading.ThreadHelper.ThreadStart()
InnerException:
For questions and discussions relating to automating Office applications (like Outlook) please see http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.officedev&lang=en&cr=US
这篇关于.NET/Outlook互操作和保存附件:一个神秘的例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!