commandBars["Menu Bar"] gives system._comobject when retrieved through reflection

M

mrudulan

Hi,
In my outlook plugin to avoid the reference to office dll I am
accessing the properties using reflection.
Here's my code.

Explorer explorer = _applicationObject.ActiveExplorer();
PropertyInfo pi = explorer.GetType().GetProperty("CommandBars");
object objCommandBars = pi.GetValue(explorer,new object[0]);
object objMenu =
objCommandBars.GetType().InvokeMember("Item",BindingFlags.GetProperty,null,objCommandBars,new
object[]{"Menu Bar"});

Here, the last statement returns System._Comobject into objMenu.

Can anyone tell me the reason for it and how to solve it.
Thanks,
Praisy.
 
Top