Reputation: 161
I am trying to load Msg file to MailItem, I cannot find any method that can load from Stream or Array. I am forced to save the file on the Client PC. OOM I used
Application.CreateItemFromTemplate(path, Type.Missing)
I can delete the temp file right after the MailItem is created. RDO I found code
Session.GetMessageFromMsgFile(path);
I cannot delete the Msg file right after the RDOMail is created. I am coding in C#, how should I dispose the Msg?
Upvotes: 1
Views: 1338
Reputation: 66215
RDOSession.GetMessageFromMsgFile
uses the MSG file for as long as the RDOMAil
object is alive. After you are done using it, either release it using Marshal.ReleaseComObject
or cast RDOMail
to IDisposable
and call IDisposable.Dispose
.
The equivalent to Outlook's Application.CreateItemFromTemplate
would be to create a new message in one of the Outlook folders (RDOFolder.Items.Add
), and then import the MSG file using RDOMail.Import
.
Upvotes: 2