0 votes
by (270 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
by (69.8k points)
selected by
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.

by (270 points)
Yes, I would like to receive the beta build. Is there any estimate, when it will be ready? Thanks
by (69.8k 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.
by (270 points)
Do you have any updates on this?
by (69.8k 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.
by (15.2k 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 support@rebex.net.
by (270 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.
by (15.2k 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.
by (15.2k 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 support@rebex.net.