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

7th
Oct 2016
PraveenKumarKR
@PraveenKumarKR
Oct 07 2016 01:42
Hi All
I wrote a code for getting OOO setting of user
code throws below error

import java.net.URI;

import microsoft.exchange.webservices.data.core.ExchangeService;
import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
import microsoft.exchange.webservices.data.credential.ExchangeCredentials;
import microsoft.exchange.webservices.data.credential.WebCredentials;
import microsoft.exchange.webservices.data.property.complex.availability.OofSettings;

public class GetOOO {

public static void main(String[] args)
{
try
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.setTraceEnabled(true);
service.setUrl(new URI("https://email.xxx.com/EWS/Exchange.asmx"));

      ExchangeCredentials credentials = new WebCredentials("<<superUserId>>", "<<SuperUserPassword>>","XXX");
      service.setCredentials(credentials);

      OofSettings myOOFSettings = service.getUserOofSettings("<<emailId>>");

      System.out.println(myOOFSettings.getState());


      service.close();
}
catch (Exception e)
{

    System.out.println(e.getMessage());
    e.printStackTrace();
}

}
}

Error in [GetOOOSettings.process/Java Code]While executing [invoke] encountered [microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException] : [The request failed. null at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:74)
please help