0

I created an add-in for MS Outlook which simply shows some email headers info. The command for showing header info is accessible from a selected email item's context menu. Everything is good until I setup a delivery rule for sending emails. Every email is staying in outbox folder for a 2 minutes and getting sent after that. But when I'm selecting a email item it getting regular font (untouched is bold and italic) and losing it sent datetime field value and showing as "none". After that the email is staying in outbox folder without sending.

enter image description here

I found a code part which causing a such behavior

string header = (string)mailItem
                 .PropertyAccessor
                 .GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001E");

So I'm seeing that a simple GetProperty operation breaks the outbox email item state. I was unable to find any info related to the above mentioned behavior and didn't know how to fix this. So my question is how to fix this issue and why such a behavior is happening ?

1 Answers1

1

Touching a message marked for submission with OOM or the Outlook Object Model aborts the submission process.

Can you exclude messages in the Outbox folder?

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Thanks! So as I understand even GetProperty() operation touches the mailItem. I can just check if mailItem's property 'Sent' is set to false or if it in 'Outbox' folder and thus exclude from touching. If it's possible can you provide some links from where I can get more info about mentioned behavior? It will be very helpful for me. I didn't manage to find out some info by searching Internet –  Apr 25 '14 at 06:22
  • How do you retrieve the message? Are you using the Application.ActiveExplorer.Selection collection? – Dmitry Streblechenko Apr 25 '14 at 13:59
  • Yes, I'm exactly using the code you mentioned: Application.ActiveExplorer.Selection –  Apr 25 '14 at 15:15
  • 1
    Use Application.ActiveExplorer.CurrentFolder.EntryId and compare it (Namespace.CompareEntryIds) with the entry if of the Outbox folder (retrieved using Namespace.GetDefaultFolder(olFolderOutbox))). – Dmitry Streblechenko Apr 25 '14 at 16:37