1

I am trying to use the Java EWS API to download email attachment from Outlook. My requirement is as follows

  • To connect to the mailbox
  • Search for a folder named "Test"
  • Inside the test folder search for a Mail with a pattern matching subject and Body
  • If found , check the mail to have attachments
  • If any, download the attachment to a local path.

The program is working as expected when running as a standalone java program. The program is able to download the attachment to the mentioned UNIX path.

try {
    //Load attachment contents into a file.
    fileAttachment.load("/pathinunixbox/"+fileAttachment.getName());
    System.out.println("Attachment Downloaded");
}catch (Exception e) {
    System.out.println(e.getMessage());
}

But I am getting the below exception when running the above code from Web Logic server.

Exception:

The request failed. Precondition for readText is nextEvent().getTypeEventType() == START_ELEMENT

Please correct me if am doing anything wrong there. I have also compared the loading of jars between Web Logic and java program running from UNIX box. The jars loaded in the same manner.

Dineshvs
  • 11
  • 4

0 Answers0