Qualche motivo per cui il seguente codice non esce dal processo di Outlook 2007 creato tramite interoperabilità COM?C# Outlook 2007 L'applicazione di interoperabilità COM non si chiude!
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();
Un frammento quasi identico utilizzando Word funziona, quindi mi chiedo se sto dimenticando di ripulire qualcosa ...
Ha funzionato. La Sessione è un oggetto NameSpace. Grazie :) – Nikolaos
Nessun problema. Ho sostituito quel nome di classe nel codice. –