Cannot view HTML body of unsent MSG in Outlook 2007 RRS feed

  • Question

  • I've written some code to generate .msg files from scratch.  When I generate a .msg file with a pr_html_body_binary (mapi tag 0x10130102), it cannot be viewed unless it is a sent message (pr_message_flags & 8).

    To find out what should happen, I created a Draft message in Outlook and saved it to an MSG file.  All my settings say to use HTML format, not plaintext nor RTF.  However, Outlook always generates MSG with a pr_body and a pr_rtf_compressed.  It never writes out a pr_html_body.

    Is there any way to solve this, or is it simply because Outlook cannot edit HTML messages?
    Friday, March 27, 2009 10:17 PM


All replies

  • Thank you for contacting about your issue around not being able to view an HTMl body in Outlook.  Your problem does not appear to be related to the technical discussion around the content of the Exchange Server Protocols documentation.

    Depending on how you are going about implementing your solution there are a couple of other forums or newgroups that you could post your question.  Is this an add-in running in Outlook or are you doing a server side solution?

    Developer Consultant
    Monday, March 30, 2009 4:53 AM
  • Here are links to two .msg files that illustrate the problem.  One shows up in Outlook correctly, and the other shows up with a blank body.  Using your favorit docfile viewer, you will see that the two .msg files are identical except the pr_message_flags (0x0E070003).
    Monday, March 30, 2009 4:55 AM
  • This "docfile viewer" doesn't seem to be any linux thing, so I couldn't read your files. a comparison of the contents (using diff on a od) shows a lot of differences, so I wasn't able to easily check it.

    Perhaps you can tell me what the flags you are looking at are? I understand it is the 0xe07 property, but I want to know what the property is set to in the working and non-working examples.

    Monday, March 30, 2009 7:38 AM
  • Thanks Tom.  This actually isn't an add-in for Outlook nor a server-side solution.  It is code for generating msg emails from scratch, e.g., given a to, from, subject and an HTML body.

    If I don't find an answer here, I'll post in another more appropriate forum.  I just got lost when looking for an appropriate forum for this question.
    Monday, March 30, 2009 3:29 PM
  • Hi Brad.  No, it has nothing to do with Linux.  When I said "docfile viewer", I meant something like DFVIEW.exe that comes with VStudio I think, or Compound File Explorer, or any other program (there's many out there) for viewing compound files.

    The difference between the two files is the one that works has the pr_message_flags set to 1 (msgflag_read) and the one that doesn't work has the pr_message_flags set to 0x9 (msgflag_read | msgflag_unsent).
    Monday, March 30, 2009 3:31 PM
  • You might be in the right place as this is the place as the msg format is described in [MS-OXMSG] protocol documentation.   Is this what you are using as a basis of your implementation?

    Developer Consultant
    Monday, March 30, 2009 6:45 PM
  • Yes.
    Monday, March 30, 2009 11:07 PM
  • Ok, Let me dig into this to track down what is happening.

    Developer Consultant
    Tuesday, March 31, 2009 3:50 AM
  • Thanks Tom.  I look forward to your reply and any possible workarounds.  I'd like to be able to get the HTML to show up without having to flag the message as read.
    Wednesday, April 1, 2009 4:25 AM
  • bump.  it's been a week, any idea what's going on yet?
    Wednesday, April 8, 2009 3:36 PM
  • I have had a bit of a challenge debugging this issue so I am waiting on some feedback from development to help me scope this.  Sorry it's taking a bit longer than I was hoping for.

    Developer Consultant
    Friday, April 10, 2009 5:41 AM
  • Ok, thanks.  I'm happy to know you are still looking at it.
    Friday, April 10, 2009 8:33 PM
  • bump. it's been another week; if it can't be fixed that's ok, just let me know how to work around it; is there any way besides flagging the message as sent to get the body to show up?  for my needs I don't care if the body is editable or not, but I don't want to lie and say that a message is sent when it really isn't
    Monday, April 20, 2009 4:55 PM
  • I am currently having the Outlook developer support team look at this.

    Developer Consultant
    Thursday, April 23, 2009 4:39 AM
  • I also spoke with Stephen Griffin and he said that Outlook does not like PR_BODY_HTML in .MSG files.  He blogged about this as he found a bug while working with a customer.

    Here is his post

    It should be noted that Outlook makes no guarantee that the streams will be arranged in a certain order only that certain streams will exist if already present.  In fact there has been several issues where customer’s attempt to binary compare MSG files that they deem equal only to find that they are not.

    Thursday, April 23, 2009 5:56 PM
  • Thanks for the info Tom.  It was very helpful.  I guess it was pretty much as I expected: Outlook simply has issues with PR_BODY_HTML in MSG files.  I guess I should count my blessings that it works at all, and that I have a means of getting it to show up by flagging the message as read, and I don't care about the ability to edit the message.

    Don't worry about the order of the streams in the MSG.  I already know how docfiles works so I understand why you can't do a binary comparison of MSGs.  I've never tried to do anything like that; it was just something Brad Hards tried to do I guess.
    Thursday, April 23, 2009 10:55 PM