0

I am using the excellent example at CodeProject to read .MSG files however many are coming back with no body text. I have stepped into the code and I believe this is because the property key __substg1.0_1000 of the Outlook message does not exist (GetMapiPropertyFromStreamOrStorage() method of Outlook Storage) in the message properties.

Do I need to look for an alternate property key to read the message body from these emails and if so what is it? Is there another way around this?

Liath
  • 9,913
  • 9
  • 51
  • 81

1 Answers1

1

I'm not near a computer, well, I guess my phone is sort of a computer, but are you sure they're emails? Calendar and contact items generally won't have that property.

PidTagBody, PidTagHtmlBody, and PidTagRtfBody(?) are all properties that can contain body information. However, if there is an HTML or rtf body, you will almost always have PidTagBody property populated.

You can check the PidTagMessageClass property to determine if its an email, note, contact, etc. An email will have the value "IPM.Note". You'll have to look up the property ids for these names yourself, at least until I can get near a computer.

Christopher Currens
  • 29,917
  • 5
  • 57
  • 77
  • These are all bounce emails which I've exported and am attempting to process so I believe they're valid. BodyText and BodyRTF are both null so I guess it's possible that they're html only... any advice you can give on Property IDs and mappings would be appreciated - this is not my speciality and I'm only delving in to try and understand why these properties are null. – Liath Nov 13 '12 at 20:26
  • @Liath - Bounce emails are stored in a special way by outlook. They're also not `IPM.Note` types. There should be an embedded message as an attachment, that is the original email that was sent. That would have your BodyText. – Christopher Currens Nov 13 '12 at 20:31
  • thanks, a lot of them do indeed have attachments - this particular one doesn't. I'm trying to extract the original email's recipient which is often given in the message text (can you tell what it is yet?) and was doing a RegEx on the message text - this works in about 1/4 of cases but not all. – Liath Nov 13 '12 at 20:35