Reputation: 420
I am writing VSTO Outlook add-in that needs to save some items as msg files. The problem is, each time I call MailItem.SaveAs it causes Outlook to lag slightly and show processing cursor (blue circle). I have tried moving it int a separate thread, but that does not help. Saving item is quite fast (less than 100 ms most of the time), but still causes this annoying behavior. I need to save an item to read it as MSG format, so if I can do this directly this would be even better, but as I found here: Outlook MailItem as Stream the only solution seems to use EWS for this. Are there other alternatives?
Maybe using RDO can help in this case? Another option, as I understand, create msg manually from mail item properties. But maybe there is an easier way?
Upvotes: 0
Views: 367
Reputation: 49397
Unlike OOM, a low level API on which Outlook is based on (Extended MAPI) supports multithreading. So, you can run the code on a secondary thread without any visible impact to the Outlook UI. See INFO: Save Message to MSG Compound File for more information.
Also you may consider using third-party wrappers around Extended MAPI such as Redemption.
Upvotes: 3