These are chat archives for OfficeDev/ews-java-api

12th
Nov 2015
thanhlv93
@thanhlv93
Nov 12 2015 04:15
Hi , I using EWS API but when my run application then exeption HTTP Client not connect . Plz help me.
I am using Http client 3-1 .
Micha Roon
@drgorb
Nov 12 2015 07:23
without some code, no one can help you
thanhlv93
@thanhlv93
Nov 12 2015 09:02
I am trying EWS with version 1.0 and i user to get infomation by NameResolutionCollection but exeption thrown : "microsoft.exchange.webservices.data.EWSHttpException: Connection not established" .
Code :
NameResolutionCollection nameResolutions = service.resolveName(username, ResolveNameSearchLocation.ContactsOnly, true);
thanhlv93
@thanhlv93
Nov 12 2015 09:10
i want get accout profile(ex : account Name) when login to server .. You have the solution for me ?.
Micha Roon
@drgorb
Nov 12 2015 10:16
here is a simple connection class that works
public class TestConnect {
    public static void main(String[] args){
        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
        ExchangeCredentials credentials = new WebCredentials("address@server.net", "password");
        service.setCredentials(credentials);

        try {
            service.autodiscoverUrl("address@server.net");
            ItemView view = new ItemView(10);
            FindItemsResults<Item> findResults = service.findItems(WellKnownFolderName.Inbox, view);

            for (Item item : findResults.getItems()) {
                // Do something with the item as shown
                System.out.println("id==========" + item.getId());
                System.out.println("sub==========" + item.getSubject());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
but this is with the 2.0 version
my dependency looks like this
        <dependency>
            <groupId>com.microsoft.ews-java-api</groupId>
            <artifactId>ews-java-api</artifactId>
            <version>2.0</version>
        </dependency>
thanhlv93
@thanhlv93
Nov 12 2015 10:31
thanks , I'm doing test your way.
thanhlv93
@thanhlv93
Nov 12 2015 10:38
Can you show me what you use the library?
ex .. Http client version ?
thanhlv93
@thanhlv93
Nov 12 2015 10:43
i'm using Android studio should haven't
<dependency>
<groupId>com.microsoft.ews-java-api</groupId>
<artifactId>ews-java-api</artifactId>
<version>2.0</version>
</dependency>
thanhlv93
@thanhlv93
Nov 12 2015 15:50
I'm using Ews version 2.0 but exeption thrown :
Caused by: java.lang.NoSuchFieldError: org.apache.http.conn.ssl.AllowAllHostnameVerifier.INSTANCE
Plz , I needed a solution .