Exchange server – cannot get sender email address using EWS Java API
•
Java
I am using EWS Java API 1.1 5. I am trying to get the email sender as follows:
ItemView view = new ItemView(10); FindItemsResults<Item> findResults = service.findItems( WellKNownFolderName.In@R_969_2419@,view); for (Item item : findResults.getItems()) { if (item instanceof EmailMessage) { String senderEmail = ((EmailMessage) item).getSender().getAddress(); System.out.println("Sender Email: " + senderEmail); } } );
But it always returns null I have also tried the following:
String senderEmail = ((EmailMessage) item).getFrom().getAddress();
But it also returns null I can see that the email contains the sender:
Test User <testuser@testdomain.com>
It appears in messages, and so does when replying to emails
Please show me how to solve this problem
Solution
To find a solution, I must use item load(); Before receiving the sender's e-mail address
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码