How we can display .msg file in salesforce

Hi i have implemented drag and drop outlook emails and files in to sales force.If we drag some file it will store that file into attachment object similarly if we drag some .msg file i.e outlook email it will store into attachment object.To display file content i am using following code as:

<a href="#" onClick='window.open("https://c.na15.visual.force.com/servlet/servlet.FileDownload?file='attachmentid'","Ratting","width=850,height=600,left=150,top=90,toolbar=1,status=1,");'> 
                                                    </a> 

In above code if we pass attcahment id of file it will display content of file but if it is .msg file it is downloading file rather than showing content.Is there any way to directly display content of .msg file rather than downloading. Even how we can parse .msg file in java Script.

Answer

You would have to parse the file first. You can do this in JavaScript (it would be non-trivial, but possible), and you can probably accomplish this in Apex Code in the next release (due to the removal of the 200,000 line limit in exchange for a CPU time limit). Some browsers may choose to embed the content (e.g. run an instance of the mail agent inside the browser), but you cannot force this as a developer. You might try using the embed tag, but this is highly dependent on the OS and browser.

Attribution
Source : Link , Question Author : Jayant Jadhav , Answer Author : sfdcfox

Leave a Comment