Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android Outlook email
I am trying to open a .MSG file through my application. I tried with setting the MIMETYPE as `vnd.ms-outlook`, 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/vnd.ms-outlook";
 
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/vnd.ms-outlook for method 1 and null when i use method 2
 Log.i(TAG, "Extension :" + extension + "\n" + "MIME :" + mimetype); 
 intent.setDataAndType(Uri.fromFile(file),mimetype);
 startActivity(intent);
 
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.
 
Thanks.
Posted 18-Nov-12 20:05pm
Edited 18-Nov-12 20:07pm
v2
Comments
TorstenH. at 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 at 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.
 
Thanks.

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

  Print Answers RSS
0 OriginalGriff 375
1 Sergey Alexandrovich Kryukov 329
2 CPallini 260
3 DamithSL 214
4 Maciej Los 197
0 OriginalGriff 5,455
1 DamithSL 4,457
2 Maciej Los 3,885
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,115


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2014
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