Get a thumbnail image of a MailItem?


Jason Thomas

I'm writing an app where I need to save outlook items (such as an email
message) as a thumbnail image. I was hoping that the Inspector would
have such a method, or implement the IViewObject interface, or expose
it's hwnd, so I could send it an WM_PRINT message. Unfortunately, none
of these techniques work. So, I could use the SaveAs(html) method on
the MailItem, load the resulting file with msie, grab it's document,
cast to a IViewObject and go. This will work, but with the new
security model, when one performs SaveAs, Outlook displays an ugly
security message to the user (to prevent bad guys from using the api's
to harvest email addresses). Since I'm only trying to get a
screenshot, not care about the contents, this would lead to a bad user
experience and just as importantly, SaveAs(fn, OlSaveAsType.olHTML)
doesn't always seem to work.

Does anyone know a better way to get a thumbnail of the message?




Ken Slovak - [MVP - Outlook]

You can get the hwnd of an Outlook Inspector, but it's a very roundabout
method. You would get the Inspector.Caption property, use that name to
search all open windows using the Win32 API and then get the hwnd from that.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question