Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 445
  • Last Modified:

Display a specific Outlook message in a WebBrowser control ( formatted as I see it in Outlook)

After the usual searches I only got this old code that does not run anymore (CreateTempMht does not exist in email class):

 string mhtFilename = email.CreateTempMht("c:/MailClientData/temp/temp.mht");
    if (mhtFilename == null)
    {
        MessageBox.Show(email.LastErrorText);
        return;
    }
      
    // Load the MHT in the WebBrowser:
    webBrowser1.Navigate("file:///C:/MailClientData/temp/temp.mht");


Any Help?
0
novreisb
Asked:
novreisb
  • 2
1 Solution
 
David Johnson, CD, MVPOwnerCommented:
you can save the mht as an attachment but it probably will be blocked by outlook.
0
 
novreisbAuthor Commented:
Hi David,
It was not easy for me to put the msg in webbrowser control, so I made the option the most  easy (not the best option, but it works for a "Proof of Concept" programmer like me).
I save it as msg file and open it at once

mail.SaveAs(@"C:\temp\" + ID + ".msg", Outlook.OlSaveAsType.olMSG);
                outlook1.Session.OpenSharedItem(@"C:\temp\" + ID + ".msg");
                mail.Display(true);
                Marshal.ReleaseComObject(mail);

Thks anyway
0
 
novreisbAuthor Commented:
I only program to have a Proof of Concept (prototype). Once the results (what is seen by my  potentials customers ) are good, I will give my code to a professional programmer to put it right!
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now