none
Unable to access Inbox folder from Java code using ews-java-api-2.0.jar RRS feed

  • Question

  • Dear All,

    We would need your kind help on below issue.

    With below sample Java code I am able to construct exchange service object by connecting to Exchange server using "ews-java-api-2.0.jar".

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
    service.setUrl(new URI("https://domain.com/ews/Exchange.asmx"));ExchangeCredentials credentials = new WebCredentials("email-id", "password", "DIR");
    service.setCredentials(credentials);

    However, when I try to get Inbox details, getting below error

    Folder rootfolder = Folder.bind(service, WellKnownFolderName.Inbox); // WellKnownFolderName.PublicFoldersRoot/MsgRootFolder

    microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. The request failed. The remote server returned an error: (401)Unauthorized
    at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:74)
    at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:158)
    at microsoft.exchange.webservices.data.core.ExchangeService.bindToFolder(ExchangeService.java:504)
    at microsoft.exchange.webservices.data.core.ExchangeService.bindToFolder(ExchangeService.java:523)
    at microsoft.exchange.webservices.data.core.service.folder.Folder.bind(Folder.java:98)
    at microsoft.exchange.webservices.data.core.service.folder.Folder.bind(Folder.java:147)

    Appreciate your quick resolution steps.

    Thanks,

    Kumar


    • Edited by MSKumar562 Friday, August 4, 2017 5:31 AM
    Friday, August 4, 2017 5:28 AM