Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

EWSJavaAPI_1.2: Fetching Mime content of a message which is attached to another message.

$
0
0

Hi 

I like to get Mime content of a attachment which is an email. I want to save that attachment as eml file format. Below funcation fails at  { att.load(EmailMessageSchema.MimeContent); }. error is Cannot cast PropertySet to PropertyDefinitionBase.. Any ideas how to fetch that data?


AttachmentCollection attachmentsCol = emsg.getAttachments(); 
for (int i = 0; i < attachmentsCol.getCount(); i++) {
 
if(attachmentsCol.getPropertyAtIndex(i) instanceof FileAttachment){
FileAttachment attachment=(FileAttachment)attachmentsCol.getPropertyAtIndex(i);
 
if(attachment.getId().equals(id)){
fileType=attachment.getName().substring(attachment.getName().lastIndexOf("."));
attachment.load(name+fileType);
}
}else if(attachmentsCol.getPropertyAtIndex(i) instanceof ItemAttachment){
ItemAttachment att = (ItemAttachment) attachmentsCol.getPropertyAtIndex(i);
if(att.getId().equals(id)){
fileType =Constant.ECM_EXCHANGE_FORMAT;
//'addProp.add(new PropertySet(EmailMessageSchema.MimeContent));
att.load(EmailMessageSchema.MimeContent);
MimeContent mc =att.getItem().getMimeContent();


}
}

}



Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>