Click here to Skip to main content
13,053,026 members (60,439 online)
Rate this:
Please Sign up or sign in to vote.
I am trying to open a .MSG file through my application. I tried with setting the MIMETYPE as ``, still i couldn't able to open up the .MSG file as i expected, then i tried with attaching the same .MSG in email and opened in my device. It opened like a charm.

So my question is , How can i open up the .MSG file in android programmatically within the application.

Tried with following methods,

Method 1 : Setting the MIMETYPE manually

mimetype = "application/";

Method 2 : Fetching the MIMETYPE through `MimeTypeMap`

String extension = android.webkit.MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(file).toString());
String mimetype = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); 
// extension is msg

Opening the .MSG file through another installed application

// Prints msg for extension and mimetype = application/ for method 1 and null when i use method 2
 Log.i(TAG, "Extension :" + extension + "\n" + "MIME :" + mimetype); 

The mimetype in Method 2 results null and the mimetype set explicitly too doesn't work.

Could anybody share their thoughts on solving this issue.

Posted 18-Nov-12 19:05pm
Updated 18-Nov-12 19:07pm
TorstenH. 19-Nov-12 6:09am
He already tried some things on StackOverflow: Question there.

I can't add in more than already said there.
But just to ask - WHY do you want to open *.msg-files on a android machine? I mean, it's not like they are there, or at least I don't know an "Outlook for Android".
Gopikrish T 19-Nov-12 22:39pm
Hi TorstenH,

Thanks for your reply. Yeah, I have already tried with lot of ways to achieve the solution. Still, I couldn't able to find it.

I will try to make it more clear regarding my question. I am working on a file manager kind of application, in which i need to open an .MSG(Outlook item file) through a supportable installed application in the device. I came to know that i can able to open the .MSG file through the application called "Office Suite". Though , it is installed on my device, When i tried to open it through this application, Its not getting opened(Throws ActivityNotFoundException). but, When i open the same file(.MSG) which is attached in the email,"Office Suite" opens that file.

I hope, I have conveyed my query at the best. Please let me know your valuable suggestions.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100