我正在使用Aspose.Email程序集来检查邮件服务器的收件箱中是否有任何收到的邮件。但是下面代码中的emailClient.ListMessages(emailClient.MailboxInfo.InboxUri)方法返回如下错误,
错误:
The remote server returned an error: (405) Method Not Allowed.
代码:
System.Net.NetworkCredential credential = new System.Net.NetworkCredential("username", "password", "domainname");
Aspose.Email.Exchange.ExchangeClient emailClient = new Aspose.Email.Exchange.ExchangeClient("MailserverUri", credential);
Aspose.Email.Exchange.ExchangeMessageInfoCollection messageInfoCollection = emailClient.ListMessages(emailClient.MailboxInfo.InboxUri);
堆栈跟踪:
at Aspose.Email.Exchange.ExchangeClient.GetMailboxInfo(String mailbox)
at Aspose.Email.Exchange.ExchangeClient.GetMailboxInfo()
at Aspose.Email.Exchange.ExchangeClient.get_MailboxInfo()
at ACS.PMO.MainForm.ProcessAction() in D:\Projects\MainForm.cs:line 54
at ACS.PMO.ClientService.MCPClient.ExecuteProcess()
编辑
Aspose.Email.Exchange.ExchangeClient emailClient = new Aspose.Email.Exchange.ExchangeClient("MailserverUri", credential);
我针对的MailserverUri是 Exchange Web 服务。