Bất kỳ ý tưởng nào tại sao mã sau không thoát khỏi quá trình Outlook 2007 được tạo thông qua COM interop?C# Outlook 2007 COM interop ứng dụng không thoát!
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
var item = app.Session.OpenSharedItem("C:\\test.msg") as Microsoft.Office.Interop.Outlook.MailItem;
string body = item.HTMLBody;
int att = item.Attachments.Count;
(item as Microsoft.Office.Interop.Outlook._MailItem).Close(Microsoft.Office.Interop.Outlook.OlInspectorClose.olDiscard);
System.Runtime.InteropServices.Marshal.ReleaseComObject(item);
(app as Microsoft.Office.Interop.Outlook._Application).Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
System.Diagnostics.Debugger.Break();
Một đoạn gần như giống hệt sử dụng Word làm việc, vì vậy tôi tự hỏi, nếu tôi quên để làm sạch một cái gì đó ...
Điều đó có hiệu quả. Session là một đối tượng NameSpace. Cảm ơn :) – Nikolaos
Không sao cả. Tôi đã thay thế tên lớp đó trong mã. –