![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi
I am using below code to send email from a vb.net app; Public WithEvents OutlookApp As Outlook.Application Dim ns As Outlook.NameSpace OutlookApp = New Outlook.Application ns = OutlookApp.GetNamespace("MAPI") ns.Logon() Dim em As Outlook.MailItem em = CType(OutlookApp.CreateItem(Outlook.OlItemType.olM ailItem), Outlook.MailItem) em.Display(False) Marshal.ReleaseComObject(em) ns.Logoff() Marshal.ReleaseComObject(ns) Marshal.ReleaseComObject(OutlookApp) The code works fine for the first time but running it again produces the following error; System.Reflection.TargetInvocationException was unhandled by user code Message="Exception has been thrown by the target of an invocation." Source="mscorlib" InnerException: System.Runtime.InteropServices.InvalidComObjectExc eption Message="COM object that has been separated from its underlying RCW cannot be used." Source="Interop.Outlook" StackTrace: at Outlook.ApplicationEvents_EventProvider..ctor(Obje ct ) What is the problem and how can I fix it? Thanks Regards |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2003 primary interop advise | John | Outlook - General Queries | 4 | February 5th 08 09:18 PM |
Interop Assemblies for Outlook 2000 | John | Outlook - General Queries | 1 | February 4th 08 07:09 PM |
How to get Microsoft.Office.Interop.Outlook.TaskItem from the IUnknown (C#) | Godandag | Add-ins for Outlook | 5 | April 5th 07 09:39 AM |
Outlook Interop: Attachments.Add throws Exception | Ferdinand Zaubzer | Outlook and VBA | 1 | June 19th 06 03:10 PM |
Outlook Interop COM Exception When Logged in as Windows Standard User | [email protected] | Add-ins for Outlook | 0 | April 27th 06 12:34 AM |