COMException:客户端操作失败 Outlook [英] COMException: A client operation failed Outlook
问题描述
在我的应用程序中,我存储了不同的文件夹 EntryID(电子邮件、联系人...)以便以后选择它们.问题是,有时我会收到 COMException:
in my Application I store different Folders EntryIDs (Emails, Contacts...) in order to select them at a later point. The problem is, sometimes I get a COMException:
客户端操作失败.(在Microsoft.Office.Interop.Outlook.NameSpaceClass.GetFolderFromID(StringEntryIDFolder, Object EntryIDStore))
更新:我在同一个操作中又收到一条错误信息(没有修改代码)
Update: I got another error message at the same operation (without modifying the code)
消息传递接口返回了一个未知错误.如果问题仍然存在,请重新启动 Outlook
我的代码如下:
outlookApp.Session.GetFolderFromID(searchFolder);
OutlookApp 是这样定义和声明的:
OutlookApp is defined and declared that way:
private ApplicationClass outlookApp;
try
{
outlookApp = new Microsoft.Office.Interop.Outlook.ApplicationClass();
}
catch (System.Exception)
{
try
{
outlookApp = Activator.CreateInstance(Type.GetTypeFromProgID("Outlook.Application")) as Microsoft.Office.Interop.Outlook.ApplicationClass;
}
catch (System.Exception)
{
outlookApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Outlook.Application") as Microsoft.Office.Interop.Outlook.ApplicationClass;
}
}
我的建议是,这以某种方式连接到共享文件夹,但我无法定期重现该错误.Outlook 处于缓存模式.Exchange 在日历方面抛出了很多同步错误,但我没有在处理它们.我无法在带有用户邮箱的测试虚拟机上重现该错误.我尝试使用办公室的内部工具进行修复(发现错误),但这也没有解决任何问题.
My suggestion is, that this is somehow connected to shared folders, but I am not able to reproduce the error on a regular basis. The Outlook is in Cache Mode. Exchange is throwing a lot of Sync Errors with Calendars, but I'm not working on them. I cannot reproduce the error on a test vm with the users mailbox. I tried repairing with the internal tool from office (it found errors), but this did not fix anything either.
推荐答案
如果您在网络环境中工作,则会出现错误.这是不可避免的.您的代码必须准备好处理此类错误.
If you are working in a networked environment, you will have errors. This is unavoidable. Your code must be prepared to handle errors like that.
这篇关于COMException:客户端操作失败 Outlook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!