dasdassdayxc<
New Member
In our web Application our clients are use to attach .msg (outlook email) as a reference.What I am trying to do is show the html body of .msg file in a .aspx pageBelow code is working fine with VS 2010 IDE but when I deploy on same machine I am getting following Error,Please Help me\[code\] Public Shared Function GetMessageHTML(ByVal MsgPath As String) As String Dim app As Microsoft.Office.Interop.Outlook.Application = Nothing Dim session As Microsoft.Office.Interop.Outlook.NameSpace = Nothing Dim mail As Microsoft.Office.Interop.Outlook.MailItem = Nothing Dim HtmlBody As String = String.Empty Dim NewHTMLBody As String = String.Empty Try app = New Microsoft.Office.Interop.Outlook.Application() session = app.Session mail = DirectCast(session.OpenSharedItem(MsgPath.Trim()), Microsoft.Office.Interop.Outlook.MailItem) HtmlBody = mail.HTMLBody TryCast(mail, Microsoft.Office.Interop.Outlook._MailItem).Close(Microsoft.Office.Interop.Outlook.OlInspectorClose.olDiscard) TryCast(app, Microsoft.Office.Interop.Outlook._Application).Quit() Try My.Computer.FileSystem.WriteAllText(HtmlFName, NewHTMLBody, False) Catch ex As Exception Return "File Write Exception " & ex.Message End Try Catch ex As System.Exception Return "Read Exception " & ex.Message Finally If mail IsNot Nothing Then System.Runtime.InteropServices.Marshal.FinalReleaseComObject(mail) End If If session IsNot Nothing Then System.Runtime.InteropServices.Marshal.FinalReleaseComObject(session) End If If app IsNot Nothing Then System.Runtime.InteropServices.Marshal.FinalReleaseComObject(app) End If End Try Return HtmlFNameEnd Function\[/code\]Above Code read .msg file and save html body content to a new .html file then I am showing that new html in an IFrame.I am using Windows 7 with VS 2010 and it work perfectly in development environment but when I publish on localhost (same machine) I am getting below error
Can any one guide me how to fix this issue ? I have given Full Permission on physical folder to user IIS_IUSRS