Following Ries Vriend's answer in regards to loading CDO.Message from EML file, I'm trying to modify the message's body and attachments and save it back to a file (while keeping the original format of the file).
I wrote the following, which doesn't work - the message is written to the file, but the message is not modified and the charset is different from the original message:
CDO.Message msg = new CDO.MessageClass();
//load message from EML file
//....
//try to modify the body of the message
message.TextBody = "Modified body";
ADODB.Stream stream = new ADODB.StreamClass();
stream.Open();
stream.Type = message.GetStream().Type;
stream.Charset = message.GetStream().Charset;
message.DataSource.SaveToObject(stream, "_Stream");
stream.SaveToFile("modified.eml", ADODB.SaveOptionsEnum.adSaveCreateOverWrite);