I have a solution where I need to parse incoming mails in an inbox, which is stored in Office 365.
I’m using the ExchangeEWS client, and I can connect, read mails, and convert messages to MailMessage just fine, and have access to all the data from the mail.
The issue is, that depending on the content of the mail, I need to add a specific header to the mail, and save it back to the mailbox.
I have tried using the UpdateItems method, by creating a new ExchangeStreamedItem class. I saved the updated MailMessage to a stream and converted it to a byte array. I have then tried sending it to Exchange EWS with different ID’s (MailMessage.MesageId and ExchangeMessageInfo.UniqueUri), but I always get an error back. I am unsure of if it is the byte array of the updated message, og if it’s the ID. Anyway, I have been unable to post the mail back to the EWS for updating.
Do you have a sample on how to post back updates to an existing mail using the EWS client?