I am using the following code to open the signed/unsigned
Outlook messages and I display the content in WebBrowser
control.
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
var item = app.Session.OpenSharedItem(msgfile) as Microsoft.Office.Interop.Outlook.MailItem;
string message = item.HTMLBody;
app.Session.Logoff();
It is working fine for the first time the file is opening, but after closing the Outlook file trying to reopen the file it showing the following error:
"Cannot open file: C:\tion.msg. The file may not exist, you may not have permission to open it, or it may be open in another program. Right-click the folder that contains the file, and then click Properties to check your permissions for the folder."
After some time later it is opening fine. For this strange behavior what could be the reason and how to rectify the the error message?