Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to get attached meeting .ics file

843834Jan 12 2009 — edited Jan 15 2009
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 12 2009
Added on Jan 12 2009
6 comments
660 views