How to determine the format of a mailitem (Plain Text, RTF, HTML etc)

A

Alan

Hi All,

I would like to be able to test a mailitem and return the format type
being one of the following:

Plain Text
Rich Text
HTML

I thought that would be quite easy, but I can't seem to work out how
to do it.

Apologies in advance if I am just being dim and it is staring me in
the face!

Thanks,

Alan.
 
A

Alan

Dmitry Streblechenko said:
Use the MailItem.BodyFormat property.

Hi Dmitry,

I cannot seem to see that property in my object browser.

I can see the following properties (amongst many others):

..Body
..HTMLBody

I had thought that (presumably) the .HTMLBody is empty unless the
format is HTML, but that does not allow for differentiating between
Plain Text and RTF (which I would definately like to be able to do)
and also I was not sure that .HTMLBody is non empty if and only if the
format is HTML.


I should have mentioned that I am using Outlook 2000 (SP3) - perhaps
it is a version issue?

If so, is there a workaround for OL2000?

Thanks,

Alan.
 
D

Dmitry Streblechenko

BodyFormat property was introduced in Outlook 2002. In the previous version
of Outlook you will need to read the RTF body (Extended MAPI or Redemption):
if it has "\fromhtml1" in the first 100 or so bytes, you have HTML, if you
have "\fromtext" - it is text, otherwise it is pure RTF.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

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

Top