Gibt es irgendwelche Ideen, warum der folgende Code den Outlook 2007-Prozess, der über COM-Interop erstellt wurde, nicht beendet?C# Outlook 2007 COM-Interop-Anwendung wird nicht beendet!
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();
Ein fast identischer Schnipsel mit Word arbeitet, so frage ich mich, ob ich etwas ...
Das hat funktioniert. Die Sitzung ist ein NameSpace-Objekt. Danke :) – Nikolaos
Kein Problem. Ich habe diesen Klassennamen im Code ersetzt. –