Hi Cedric,
You may need to add reference to the Outlook Com Object.
"Microsoft Outlook 11.0 Object Library"
1. Right click on the Reference in the solution explorer and select Add
reference
2. In the "Add reference" dialog select COM tab
3. Browse to "Microsoft Outlook 11.0 Object Library" and select it to add
to the reference and click ok to close the dialog
I changed the code sinipper from the KB as follows.
try
{
Outlook.Application oOutlook=(Outlook.Application)applicationObject;
oCommandBars =(CommandBars)oOutlook.ActiveExplorer().CommandBars;
//oCommandBars = (CommandBars)applicationObject.GetType().InvokeMember
//("CommandBars", BindingFlags.GetProperty , null,
applicationObject ,null);
}
catch(Exception)
{
// Outlook has the CommandBars collection on the Explorer object.
object oActiveExplorer;
oActiveExplorer=
applicationObject.GetType().InvokeMember("ActiveExplorer",BindingFlags.GetPr
operty,null,applicationObject,null);
oCommandBars=
(CommandBars)oActiveExplorer.GetType().InvokeMember("CommandBars",BindingFla
gs.GetProperty,null,oActiveExplorer,null);
}
If you have any concern on this issue, please post here.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure!
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.