c# - Aspose.Email assembly to check a mail server ListMessages method fails -
i using aspose.email assembly check mail server received mails in inbox. emailclient.listmessages(emailclient.mailboxinfo.inboxuri) method in code below returns following error,
error:
the remote server returned error: (405) method not allowed. code:
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); stack trace:
@ aspose.email.exchange.exchangeclient.getmailboxinfo(string mailbox) @ aspose.email.exchange.exchangeclient.getmailboxinfo() @ aspose.email.exchange.exchangeclient.get_mailboxinfo() @ acs.pmo.mainform.processaction() in d:\projects\mainform.cs:line 54 @ acs.pmo.clientservice.mcpclient.executeprocess() edit
aspose.email.exchange.exchangeclient emailclient = new aspose.email.exchange.exchangeclient("mailserveruri", credential); the mailserveruri targeted exchange web service.
finally got corrected.....
exchangewebserviceclient should used in case of exchange webservice. use class instead of exchangeclient.the server url different in case of ews.the code used overcome error follows,
exchangewebserviceclient client = new exchangewebserviceclient("https://exchange-server-host/ews/exchange.asmx", "username", "password", "domain"); for further details check link below,
Comments
Post a Comment