I have a Outlook 2013 addin that has a ItemSend Eventhandler that I can't get to work right.
What it does is:
Loops all recipients (to, cc, bcc) and creates a separate copy for each with only that email as recipient and sends them. Then deletes them from sent mail folder. This works fine.
Creates one more copy, that has the original to, cc and bcc information. Uses the move-method to move it to the Sent items folder, because Save would put it in Outbox. It must not be actually sent, it should be just your personal copy as if it would have been sent normally.
Sets cancel = true and closes the inspector window with discard, so the original is never sent either. This works too.
The problem is the saved copy. When I open it, it's in compose mode. Basically it is same as it would be a draft. I want to see it as it would have been sent, in read mode.
I read that the Sent-property determines what mode to show it in, but that property is readonly, as are SentOn which is null and that would be a problem too even if the mode would be right. Is there any way around this?
I even tried to take one of the other mails that where actually sent, from Sent Items folder, edit the content and save it. But this results in the same behaviour. Also that MailItem has Sent = False and SentOn = null.
Could this be because it hasn't actually been sent yet even if Send-was called, as we are still running the EventHandler and I don't think Outlook actually sends it in another thread?
Anyway this doesn't seem to be a working workaround.
Any ideas how to implement this kind of functionality?