We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Echange Client

Dear Aspose Team

I am testing the Aspose Email Library with the goal to eliminate the existing java mail api.

Whereas the Unittests with IMAP and POP3 works as expected, I have no luck to get the Aspose Email client running. The old library works well, but if I decide to change to Aspose I would prefere to run all mail - connections via the same library.

Below I have the sourcecode, wich correspondent with the example in the ‘Programmers Guide’.

===== start source example

ExchangeClient client = new ExchangeClient(“https://outlook.office365.com/ews/exchange.asmx 1”,

“user”, “password”, “”);
 
ExchangeMailboxInfo mailboxInfo = exchange.getMailboxInfo();
====== end source example

EXCEPTION: The exception at the method-call ‘getMailboxInfo()’ says:

ExchangeException: The remote server returned an error: (405) Method Not Allowed.

I could not find out, what is wrong with the example above, particularly the account works

with another library.

best regards

Arne Stocker

Hi Arne,

Thank you for posting your inquiry.

We have analyzed your code sample and found that you are using the wrong class for accessing Exchange Server. ExchangeClient is used to connect to Exchange servers via WebDav protocol e.g. Exchange Server 2003 and 2007 only. In order to connect to Exchange Server via Exchange Web Service (EWS), you have to use the IEWSClient class for Exchange server 2007 and above. Please try the following code sample and share your feedback with us. The credentials provided in this code sample are of a valid test Office365 account that you can use for your testing purpose.

Code:

IEWSClient client = EWSClient.getEWSClient(“[https://outlook.office365.com/ews/exchange.asmx ](https://outlook.office365.com/ews/exchange.asmx)”,

"Userone@ase1986.onmicrosoft.com", “Aspose1234”, “”);

ExchangeMailboxInfo mailboxInfo = client.getMailboxInfo();

Hi Muhammad



thanks for your quick response. First I tried the EWSClient. Because it doesn’t work, I tried again with the Webdav Client.



It was my fault, that I send the incorrect example.



When I tried the EWS Client, it takes more then 60 seconds to connect (or to retrieve the client instant) and when I call





client.setTimeout(20000)

client.getMailboxInfo();





then it takes 20 seconds until I get an exception



EXCEPTION: The request timed out



best regards

Arne

the complete code was:

IEWSClient client = EWSClient.getEWSClient(“https://outlook.office365.com/ews/exchange.asmx”,

“service@advolux.onmicrosoft.com”,

“XXXXXX”,

"”);

client.setTimeout(20000);

client.getMailboxInfo();

best regards Arne

Hi Arne,

The following code sample only takes 6 seconds to get completed as shown in the screenshot. Can you please try this at your end and share your feedback with us. If your particular test account is taking long to complete the same code, please share your test credentials with us for our investigation. Also, please try the same on another internet connection and see if you get it working without any delay induced.

Code:

System.out.println(new Date());

IEWSClient client = EWSClient.getEWSClient(“https://outlook.office365.com/ews/exchange.asmx”,
"Userone@ase1986.onmicrosoft.com", “Aspose1234”, “”);

System.out.println(new Date());

System.out.println(client.getMailboxSize());

System.out.println(new Date());

I tried your code without any changes (with your login-credentials) and the result is the same (wait over 60 seconds until I get an instance of EWSClient).



And because in your code no timeout is set, the method ‘getMailboxInfo()’ seem never come back.



best regards

Arne

your code (i get it with copy & paste) has the following result



Thu Oct 29 16:09:00 CET 2015

Thu Oct 29 16:10:46 CET 2015

java.lang.IllegalStateException: class com.aspose.email.system.exceptions.WebException: The request timed out

I run the example against jdk 1.8 and tried now with 1.6 -> same result, it doesn’t work.



best regards Arne



My Environment:

jre: Java JDK 1.8.0

ide: Eclipse Luna

os: Mac OSX 10.11

license: aspose license for testing purpose

I tried run the example on a (virtual) windows machine within my mac and it works.



So the api didn’t work with Mac_OSX?



best regards Arne



Thu Oct 29 16:54:10 CET 2015

Thu Oct 29 16:54:29 CET 2015

1166318

Thu Oct 29 16:54:33 CET 2015

Hi Arne,


Can you please share with us if you are using the latest version of Aspose.Email for Java API? We faced this issue with v 5.7.0 of the API and has been resolved in the subsequent version of the API. Please try it with the latest version of Aspose.Email for Java 5.8.0 and share your feedback with us.

Hi Muhammad



thanks for your hint. I’d used the Version 5.6.0 of Aspose.email. Unfortunately on MacOS-X your snippet doesn’t even work with the Version 5.8.0.



so what should I do?



best regards

Arne Stocker





jre: 1.8.0

os: Mac OS X 10.11

Fri Oct 30 11:24:01 CET 2015

Fri Oct 30 11:25:47 CET 2015

Exception in thread “main” java.lang.IllegalStateException: class com.aspose.email.system.exceptions.WebException: The request timed out

Hi Arne,


We have tested the issue at our end with Mac OS X 10.8 and it raises no such exception. We shall try to setup environment for Mac OS X 10.11 to reproduce the problem at our end and share our feedback with you.

Hi Muhammad

for what I don’t understand:



If the library is programmed without native code, why does it makes differences depending on the platform.



We had customers with Windows, Linux and Mac and of course from OS-X 10.8 to OS-X 10.11.



I’m a little bit unsure wether I should license the email-library, if the behavior changes from os to os. So I hope, it may have some other reasons.



best regards

Arne

Hi Arne,


The behavior of the API is not dependent on the OS and this seems to be an issue of the API with this specific version of OS-X. Irrespective of this issue, we always provide support to our users by resolving issues at our end. As mentioned, we are trying to setup the environment with this version of Mac OS X. If you have any link to some ISO of this OS version for setting in VM, it may help us to setup the environment quickly and investigate the issue. In any way, we are trying to establish a test environment as soon as possible for testing this issue and provide you with assistance.

Hi Arne,


Thank you for waiting for completion of our investigation.

We have tested this issue at our end with Mac OS E1-Capitan v 10.11.2 and no exception or error is raised at our end. The code sample shared earlier works well at our end and the mailbox size is retrieved fine. I would request you to please re-verify if you are using the latest version of the API at your end. Please share your feedback with us for further assistance.