View Single Post
  #5  
Old July 30th 09, 01:22 PM posted to microsoft.public.outlook.program_addins
j
external usenet poster
 
Posts: 109
Default object that has been separated from its underlying RCW

On Jul 30, 3:03*pm, Tobias Böhm wrote:
On 30 Jul., 14:00, j wrote:





On Jul 30, 2:55*pm, Tobias Böhm wrote:


On 30 Jul., 13:30, j wrote:


Hi All,


what can be reason for this??
i'm trying to retrieve commandsBar, and once in a while got this
strange exception
within Outlook 2003.


System.Runtime.InteropServices.InvalidComObjectExc eption: COM object
that has been separated from its underlying RCW cannot be used.
* *at Microsoft.Office.Interop.Outlook.ExplorerClass.get _CommandBars()


Any ideas??


Hi,


the reason for this is that you are using a COM object that is already
released.


Following code will throw that exception:


Outlook.MailItem mailItem = activeInspector.CurrentItem;
Marshal.ReleaseCOMObject(mailItem);
string mailItemSubject = mailItem.Subject;


Hope that helps,
Tobias


Thanks,


I see, however i access the Outlook excplorer's ui object.
You want to point that now even in Outlook (without any programming)
impossible to access the File Menu for example??
The Outlook is alive.
I don't understant this.


Please explain, thanks in advance.


If that happens even when you just use Outlook, maybe it's another Add-
In causing the problem. Try disabling installed Add-Ins.

Tobias- Hide quoted text -

- Show quoted text -


There is no other addIns.
My question is if for expample i execute the following line of code:
-- myExplorer is active explorer
Marshal.ReleaseCOMObject(myExplorer.CommandBars);

so now, i'll failed to work with Otulook's Menu ??


Ads