In EWS, the EmailMessage
has a sender (emailMessage.getSender()
) and may has attachments (emailMessage.getAttachments()
).
These attachments can be FileAttachment
(for files) or ItemAttachment
(for attached email).
There is a lot of information on this item attachment such as :
But how to find the sender of this attached email ?
Edit : Using EWS Java API 1.1.5 http://archive.msdn.microsoft.com/ewsjavaapi/Release/ProjectReleases.aspx?ReleaseId=5754
Following the SliverNinja response, I tried to retrieve the item as an email message.
Using EWS with Java, you have to cast the item ItemAttachment
as EmailMessage
like this:
Item item = ((ItemAttachment) attachment).getItem();
if (item instanceof EmailMessage) {
String sender = ((EmailMessage)item).getSender().getAddress();
}
The item can also be cast as Appointment or Contact or Task or ContactGroup.
Edit : Another way to get the sender is
((EmailMessage) item).getFrom().getAddress();
This looks like to do the same