RDO Outlook Redemption 从测试服务器访问邮箱
我构建了一个使用 Redemption 读取邮箱的网络应用程序,我们将其称为“[email ;受保护]”。它使用本地主机工作正常,但是当我部署它时,我得到了这个异常。
<块引用>错误 System.Runtime.InteropServices.COMException (0x80004005): 使用 CLSID 创建 COM 组件的实例 IClassFactory 中的 {29AB7A12-B531-450E-8F7A-EA94C2F3C05F} 失败 由于以下错误:80004005。at System.RuntimeTypeHandle.CreateInstance(RuntimeType 类型,布尔值 publicOnly、Boolean noCheck、Boolean&可以缓存, RuntimeMethodHandleInternal& ctor,布尔运算& bNeedSecurityCheck)位于 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean SkipCheckThis,布尔值 fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, 布尔值skipVisibilityChecks、布尔值skipCheckThis、布尔值 fillCache) 在 System.Activator.CreateInstance(Type 类型,布尔值 非公开)
我猜测我的服务器正在使用其网络用户作为登录邮箱的默认用户,而不是当前访问 Web 应用程序的 Windows NT 用户。如何让服务器或我的 RDO 代码使用当前 NT 用户(通过 RDO 使用应用程序)?
我已在服务器上安装了 MAPI 扩展,并在注册表中注册了 dll。
我的 RDO 代码如下所示
RDOSession Session = null;
rdoDefaultFolders olFolderInbox = rdoDefaultFolders.olFolderInbox;
Session = new RDOSession();//this throws the exception above
Session.LogonExchangeMailbox("[email protected]", outLookServer);
objFolder = Session.GetDefaultFolder(olFolderInbox);
I've built a web app that use Redemption to read a mailbox, let's call it "[email protected]". It works fine using localhost but when I deploy it I get this exception.
Error System.Runtime.InteropServices.COMException (0x80004005):
Creating an instance of the COM component with CLSID
{29AB7A12-B531-450E-8F7A-EA94C2F3C05F} from the IClassFactory failed
due to the following error: 80004005. at
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
publicOnly, Boolean noCheck, Boolean& canBeCached,
RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
skipCheckThis, Boolean fillCache) at
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly,
Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean
fillCache) at System.Activator.CreateInstance(Type type, Boolean
nonPublic)
I'm guessing my server is using its network user as the default user to logon to the mailbox, instead of the current windows NT user accessing the web app. How do I get the server or my RDO code to use the current NT user using the app with RDO?
I have installed MAPI Extension on my server and registered the dll in the registry.
My RDO code looks like this
RDOSession Session = null;
rdoDefaultFolders olFolderInbox = rdoDefaultFolders.olFolderInbox;
Session = new RDOSession();//this throws the exception above
Session.LogonExchangeMailbox("[email protected]", outLookServer);
objFolder = Session.GetDefaultFolder(olFolderInbox);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
噩梦(或不那么推荐)解决方案
正如德米特里(Dmitry)指出的那样,我认为问题在于应用程序的位数。然而,将应用程序转换为 32 位或 64 位的问题是,将解决方案中的每个项目转换为使用相同的位数,以便应用程序可以使用相同位的 MAPI,这是不可避免的、可怕的连锁反应。如果您有其他应用程序使用相同的库和项目,那么这些应用程序也可能会损坏,因此说起来容易做起来难。事实上,我尝试过,但它在很多方面破坏了这个项目……我认为这不值得。
最佳解决方案
对于 Exchange Server 2007_SP1 及更高版本,我们有一个方便的 Web 服务,称为 Exchange Web 服务 MAPI,它与兑换执行相同的操作...也许没有那么多,但它可以满足您的日常 Outlook 需求。请阅读下载中的指南以获取更多信息。
http://www.microsoft.com/download/ en/details.aspx?displaylang=en&id=13480
这对我来说是最好的解决方案,因为它不需要任何应用程序来指定位,它不需要任何特殊说明,并且没有松散的结束。一个简单的 DLL,可以完全满足您需要的身份验证甚至模拟功能。谁不喜欢网络服务?
示例代码
教程
再次阅读指南或谷歌搜索。
其他例子
http://omegacoder.com/?p=454
使用 Exchange Web 服务从 Exchange 下载附件
The Nightmare (Or not so recommended) Solution
The problem I believe was the bitness of the application as Dmitry pointed out. However the problem with converting your apps to 32bit or 64 bit is the inevitable and horrible chain reaction of converting EVERY project in your solution to use the same bitness so that the application can use the MAPI of the same bit. If you have other apps that use the same libraries and projects then those may also break so this is easier said than done. In fact I tried it and it broke the project in so many ways...decided it wasn't worth it.
The Best Solution
For Exchange Server 2007_SP1 and above we have a handy WebService called Exchange Web Services MAPI that does the same thing as Redemption...maybe not as much but it does the trick for your everyday outlook needs. Read the Guide in the download for better information.
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=13480
This is the best solution for me because it does not require any app to specify a bit, it does not require any special instructions and there are no loose ends. A simple DLL that does exactly what you need with authentication and even impersonation. And who doesn't like webservices?
Sample Code
Tutorials
Again read the Guide or google it.
other examples
http://omegacoder.com/?p=454
Download attachment from Exchange using Exchange Web Services