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

0 votes
asked Feb 28 by annab (270 points)

Hello
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();
mailMsg.Load(emlData);
//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 (37,860 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 (270 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 (37,860 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 (270 points)
Hello.
Do you have any updates on this?
Thanks
commented Mar 17 by Lukas Matyska (37,860 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)
Hello,

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:
http://www.rebex.net/getfile/ff3b5ef196854fbdb8085fde801c7318/RebexSecureMail-BetaBuild6291-Trial-Binaries.zip
If you have valid support contract and would like to have non-trial version, please let us know at support@rebex.net.
commented Mar 24 by annab (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.
commented Mar 24 by Pavel Matyska (9,640 points)
Hello,

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)
Hello,

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

http://www.rebex.net/getfile/e15075cdb5554e479cf5082aefd6f429/RebexSecureMail-BetaBuild6296-Trial-Binaries.zip

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