winformsexchange-serverwebdavoutlook-object-modelpublic-folders

How to create new Exchange public folders?


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)?


Solution

  • 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