昨晚我们尝试构建一些代码,从 .NET Winforms 应用程序中在 Microsoft Exchange 中创建一个新的公用文件夹。
谷歌搜索代码让我们找到了一堆涉及 http 请求和 WebDAV 的代码示例。我们经历过各种痛苦
底层连接已关闭:无法建立信任
SSL/TLS 安全通道的关系。
和
远程服务器返回错误:(440) 登录超时。
到此为止。
今天早上,我记得我们有一些旧的 VBA 代码,它们使用 Outlook 对象模型来处理 Exchange 公用文件夹。把它挖出来,适应.NET,嘿,它可以工作了。事实上,这只是几行。
有没有理由使用 http & WebDAV 而不是 OOM? WebDAV 示例基本上用于 ASP.NET 开发吗?如果我们能让 WebDAV 代码在我们的情况下工作,它会给我们任何额外的能力或灵活性吗(例如,在用户权限受限的情况下)?
We tried last night to build some code which would create a new public folder in Microsoft Exchange from within a .NET Winforms application.
Googling for code took us to a bunch of code samples involving http requests and WebDAV. We experienced all kinds of painfulness involving
The underlying connection was closed: Could not establish trust
relationship for the SSL/TLS secure channel.
and
The remote server returned an error: (440) Login Timeout.
and had to call it a day.
This morning I remembered that we had some old VBA code which used the Outlook Object Model to deal with Exchange Public Folders. Dug it out, adapted it to .NET and, hey, it works. Really it's just a couple of lines.
Is there a reason to use http & WebDAV rather than OOM? Are the WebDAV examples basically for ASP.NET development? If we could have got the WebDAV code to work in our case would it have given us any extra power or flexibility (e.g. in cases where the user has restricted permissions)?
发布评论
评论(1)
请参阅 http://www.infinitec.de/post/2008/11/26/ExchangeWebServices-WebDAV-and-untrusted-server-certificates.aspx infinitec.de/post/2008/11/26/ExchangeWebServices-WebDAV-and-untrusted-server-certificates.aspx 用于 SSL 事物和http://www.infinitec.de/post/2004/12/31/Access-the-Exchange-store-via-WebDAV-with-Form-Based-Authentication-turned-on-Updated。 aspx 用于登录超时。
如果您使用 OOM,则需要安装 Outlook 并配置属性(如果您有多个配置文件,这可能会有些困难)。
WebDAV 是一种 HTTP 协议,这意味着您几乎没有什么先决条件。话虽如此,WebDAV for Exchange 是一个相当麻烦的协议。然而,有可用的 .NET 包装器(我可以向您发送一个免费的 - 只需通过我的网站 ping 我),这使得它更容易。
但请注意,仅在 Exchange 2003 和 2007 中支持 Exchange 的 WebDAV。自 Exchange 2007 起,Web 服务可用,甚至还有托管 API:
EWS 托管 API - 下载:http://www.microsoft.com/download/en/details.aspx?id=13480
EWS 托管 API - SDK:http://msdn.microsoft.com/en-us/library/dd633710(v=exchg.80).aspx
See http://www.infinitec.de/post/2008/11/26/ExchangeWebServices-WebDAV-and-untrusted-server-certificates.aspx for the SSL thingy and http://www.infinitec.de/post/2004/12/31/Access-the-Exchange-store-via-WebDAV-with-Form-Based-Authentication-turned-on-Updated.aspx for the Login-Timout.
If you use the OOM, you rely on Outlook being installed and property configured (which can be somewhat difficult you have multiple profiles).
WebDAV ist a HTTP protocol, meaning that you have very little prerequisites. That being said, WebDAV for Exchange is a rather cumbersome protocol. There are, however .NET wrappers available (I can send you one which is free - just ping me through my website) which makes it easier.
But know that WebDAV for Exchange is only supported in Exchange 2003 and 2007. Since Exchange 2007, WebServices are available and there is even a managed API:
EWS Managed API - Download: http://www.microsoft.com/download/en/details.aspx?id=13480
EWS Managed API - SDK: http://msdn.microsoft.com/en-us/library/dd633710(v=exchg.80).aspx