简体   繁体   中英

Save Outlook.MailItem Async?

Is there any way to save an Outlook.MailItem as a .msg file in an asynchronous way?

I'm using:

MailItem.SaveAs("path", Outlook.OlSaveAsType.olMSG);

But it's slow.

Not using the Outlook Object Model - you cannot use a secondary thread inside the outlook.exe address space (COM addin): Outlook will raise an exception. If you do that from an external applications, all calls to OOM will be marshaled to the primary Outlook thread anyway.

Since you tagged your question as outlook-redemption, Redemption can do that - from your addin, store the value of the Application.Session.MAPIOBJECT in a variable as well as the MailItem.EntryID property. On the secondary thread, create an instance of the RDOSession object (that will initialize the MAPI system), set its MAPIOBJECT property to the value saved on the primary thread, call RDOSession.GetMessageFromID, then call RDOMail.SaveAs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM