Error connecting to exchange mailbox using WebDav
- by Warda
We have a windows service that uses the “WebDAV .NET for Exchange” libraries to access the mail server. The WebDav libraries attempts to access the mailbox to process mails. The Error occurs on attempting to retrieve the mailbox contents.
The Code snippet below is how the code retrieves the mailbox contents:
NetworkCredential credential = new NetworkCredential(Username, Password, Domain);
WebdavSession session = new WebdavSession(credential);
session.UserMailbox = MailServerURL;
Resource resource = new Resource(session);
if (UseFormsBasedAuthentication)
resource.PerformFormsBasedAuthentication(https://owa.domain.company.org/[email protected]/Inbox");
Mailbox myMailbox = resource.Mailbox;
Calling the “resource.Mailbox” raises the following exception:
--- System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.
at System.Net.HttpWebRequest.GetResponse()
at Independentsoft.Webdav.Exchange.Resource.a(String A_0, PropertyName[] A_1)
at Independentsoft.Webdav.Exchange.Resource.e(String A_0)
at Independentsoft.Webdav.Exchange.Resource.get_Mailbox()
at
Any helps will be more than appreciated.
Thanks