none
PR_MESSAGE_FLAGS not set correctly when resending message from shared (delegated) folder RRS feed

  • General discussion

  • When a new message is composed, the MSGFLAG_UNSENT bit should be set in PR_MESSAGE_FLAGS. That should happen if the message is new, being replied to or being resent. And the bit should be set if the source folder is the user's or a delegated, shared folder.

    With outlook 2007 and 2010 and exchange 2007, MSGFLAG_UNSENT is correctly set, in all cases. However, for resend from a shared folder and exchange 2010, the bit is not always set. Reply/forward from the shared folder works fine. What appears to happen for resend is that a new message is created with MSGFLAG_UNSENT set then the original message is copied to the new message. After the copy, MSGFLAG_UNSENT is unset.

    This looks like an exchange 2010 bug but it could certainly be something I don't understand. Does anyone have any idea what could be wrong? Is this an exchange 2010 bug?

    Tuesday, July 16, 2013 6:55 PM

All replies

  • Why do you consider this a bug? Outlook is free to set the MSGFLAG_UNSENT bit at any moment before the message is saved for the first time. I don't think MS ever documented the exact sequence.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, July 16, 2013 7:04 PM
  • I don't know if this is an exchange 2010 bug. I did some more testing. In all use cases, MSGFLAG_UNSENT is set correctly except exchange 2010, resend from shared folder. In that case, MSGFLAG_UNSENT is unset and never reset, even by the time SubmitMessage is called. Doesn't sound right to me.
    Tuesday, July 16, 2013 7:43 PM
  • If you set your mailbox for cached-mode but disable immediate send/receive, resending a message from a shared folder go into the outbox and sits there. You can then look at PR_MESSAGE_FLAGS. MSGFLAG_UNSENT is not set. In all other cases, it's set.

    Wednesday, July 17, 2013 2:02 AM
  • So apparently the message can be sent even if MSGFLAG_UNSENT is not set (which is not surprising). Why do you depend on that flag present?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, July 18, 2013 2:20 PM
  • I have an add-in that looks at messages when it runs. Based on whether the message is sent or unsent, it does different things. I've been using MAPI and PR_MESSAGE_FLAGS and MSGFLAG_UNSENT to determine the unsent state of a message. That works fine except for the use case describe here - resending from a shared folder. An edge but I still need to know the unsent state of the message.

    I did file an incident with Microsoft so we see how that unfolds.

    Thursday, July 25, 2013 8:46 PM
  • How about the Submitted property? It will be true if the item has been sent but the transport hasn't sent it yet, false after sending.

    Ken Slovak MVP - Outlook

    Monday, July 29, 2013 2:35 PM
    Moderator
  • That property corresponds to the MSGFLAG_SUBMIT bit. It is only set after Send is called and is cleared after the transport provider finishes handling the message.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, July 29, 2013 2:41 PM
  • Right.

    It seems to behave exactly as the OP wants as an indicator that the item has been submitted but not sent yet by the transport provider.


    Ken Slovak MVP - Outlook

    Monday, July 29, 2013 2:56 PM
    Moderator
  • I think the OP needs to figure out the state of the message after it is created and is being displayed by Outlook but before it is actually submitted to the transport provider.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Monday, July 29, 2013 3:23 PM
  • Dmitry is exactly right. It comes down to this. A new message is created from some source. Before being sent, I check PR_MESSAGE_FLAGS for the MSGFLAG_UNSENT bit. Based on its state, I do different things. In all cases but resend from a shared folder using exchange 2010 online, the state is correct. But in that case, the bit is not set and never is set. Why online matters, doesn't make a lot of sense but it seems to, so that may not be true.
    Monday, July 29, 2013 7:04 PM