Hi,
I am sending meeting request to different user from my custom application. When someone sends reply from their mail client/service to the meeting request, my configured microsoft exchange server receives reply mails. I parse it to get attached ics file for meeting details. Now my problem is, I am not able to get attached .ics file in case of the reply received from any hotmail user. For outlook and google users it is working fine. Here is my code:
private void getICS(File emlFile){
Session session = Session.getInstance(System.getProperties(),null);
try{
if(emlFile.getName().endsWith(".eml")){
InputStream inMsg = new FileInputStream(emlFile);
Message msg = new MimeMessage(session,inMsg);
Multipart mp = (Multipart)msg.getContent();
int totalAttachments = mp.getCount();
if(totalAttachments>0){
for(int i=0;i<totalAttachments;i++){
Part part = mp.getBodyPart(i);
String attachFileName = part.getFileName();
String disposition = part.getDisposition();
System.out.println(attachFileName+" - "+disposition);
if(attachFileName!=null){
if(attachFileName.endsWith(".ics")){
ICalendarHelper iCalHelper = new ICalendarHelper();
//Parse ics and prepare vo
net.fortuna.ical4j.model.Calendar iCalendar = iCalHelper.getICalendar(part.getInputStream());
ICalendarEventVO iCalEventVO = iCalHelper.getMeetingDetail(iCalendar,null);
System.out.println(iCalEventVO);
}
}
}
}
}
}catch(Exception e){
e.printStackTrace();
}
}
System.out.println(attachFileName+" - "+disposition);
prints null - null thrice. What could be the problem. Can it be handled in code or I need to configure exchange server accordingly?
Edited by: amit_patel_java on Jan 12, 2009 2:43 AM