Rebex.EWS.StoreMessage stores messages on exchange server in editable format

0 votes
asked Feb 28 by annab (210 points)

I am trying to put eml messages onto Exchange server, using Rebex.EWS, but messages received are in editable format, like draft messages. Below is the code I use

protected void SendMessage(byte[] emlData){
Rebex.Mail.MailMessage mailMsg = new Rebex.Mail.MailMessage();
//I tried to fix it with X-Unsent header, but it didn't work
messageMime.Headers.Add("X-Unsent", "0");
ews.StoreMessage(config.Folder.Id, mailMsg);

Thank you

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Feb 28 by Lukas Matyska (36,240 points)
selected Mar 1 by annab
Best answer

EWS ignores the "X-Unsent" header and marks new messages as "Unsent" by default.

However, it seems that it can be changed using the extended MAPI properties.

Unfortunately, it is not possible to use MAPI properties in our current API. We will definitely add this feature, but it is not as easy as it looks for the first sight.

Please let us know, whether you are interested to receive a beta when it is ready.

commented Mar 1 by annab (210 points)
Yes, I would like to receive the beta build. Is there any estimate, when it will be ready? Thanks
commented Mar 1 by Lukas Matyska (36,240 points)
We don't have an estimate to the mentioned feature, however we decided to add support for "X-Unsent" MAPI property as first step. I hope it will be available in couple of days. I will let you know, when it is ready.
commented Mar 16 by annab (210 points)
Do you have any updates on this?
commented Mar 17 by Lukas Matyska (36,240 points)
It is still in progress. Last days we were finishing new public release, so all new features were little delayed. We are sorry. I increased priority of this task, so it should be finished as soon as possible.
commented Mar 22 by Pavel Matyska (9,640 points)

I have added the requested functionality. The store message behavior is now driven by mail.IsDraft property (which corresponds to value of the "X-Unsent" header).

To store a message in read-only state, just set MailMessage or MimeMessage property IsDraft to false and then store that mail.

Because, mail.IsDraft is false by default ("X-Unsent" header is missing by default), default behavior of store message was changed as well.  

To store a message in editable state, either set mail.IsDraft to true or set the Ews.Settings.EnableIsDraftDetection option to false (default value is true).

Setting this option to false, the mail.IsDraft property is ignored and the mail is stored in editable format (which was previous behavior).

You can download trial beta build of Rebex Secure Mail from:
If you have valid support contract and would like to have non-trial version, please let us know at
commented Mar 24 by annab (210 points)
Thank you, this is just what I need. But now the messages are stored in Read state, but I would like to store them in Unread state. How can I do this? I looked in Rebex forums, but could not find a solution.
commented Mar 24 by Pavel Matyska (9,640 points)

we will look into it next week. It should be matter of setting correct value to a MAPI property which we added in that last beta build.
commented Mar 27 by Pavel Matyska (9,640 points)

please try this trial beta build which should make it possible to store messages that are not editable and in unread state.

As before, if you have valid support contract and would like to have non-trial version, please let us know at