adding a context menu in Outlook

D

donald

Hi there,

How can i add a button to the Right-mouse context menu in Outlook?

Thanks

Donald
 
R

Rog

Hi Donaly you need to attach to the the CommandBars.OnUpdate event look
for the this._explorer.CommandBars["Context Menu"];
This will be the command bar you then need to add your buttons to.
Rog
 
G

Guest

Hi,

I tried to initialise the Context menu during startup. But it does not show
up.
Is there anything i missed?

Or should i initialise the Context menu on CommandBar.update ?

thanks
 
G

Guest

Hi,

It still does not work.
And i think it should be .OnUpdate and not .Update as there is no such event
for COmmandBars.

I am pasting my code here. Please help me out.

OnStartupComplete()

{

.........
.......

_CommandBarsEvents_OnUpdateEventHandler oUpdate = new
_CommandBarsEvents_OnUpdateEventHandler(onUpdate);
this.commandBars.OnUpdate += oUpdate;

.......
}
public void onUpdate()
{

try
{
this.toolbarButton2 =
(CommandBarButton)this.commandBars["Context"].Controls["Up"];

}
catch (Exception e)
{
this.toolbarButton2 =
(Microsoft.Office.Core.CommandBarButton)this.commandBars["Context"].Controls.Add(MsoControlType.msoControlButton,
System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value);
this.toolbarButton2.Caption = "Up";
this.toolbarButton2.Style =
Microsoft.Office.Core.MsoButtonStyle.msoButtonAutomatic;
}

this.toolbarButton2.Tag = "Up";
this.toolbarButton2.Visible = true;
this.toolbarButton2.Priority = 1;
this.toolbarButton2.Enabled = true;


}

Am i missing something?
 
R

Rog

Try using "Context Menu" instead of "Context"

Rog
Hi,

It still does not work.
And i think it should be .OnUpdate and not .Update as there is no such event
for COmmandBars.

I am pasting my code here. Please help me out.

OnStartupComplete()

{

........
......

_CommandBarsEvents_OnUpdateEventHandler oUpdate = new
_CommandBarsEvents_OnUpdateEventHandler(onUpdate);
this.commandBars.OnUpdate += oUpdate;

......
}
public void onUpdate()
{

try
{
this.toolbarButton2 =
(CommandBarButton)this.commandBars["Context"].Controls["Up"];

}
catch (Exception e)
{
this.toolbarButton2 =
(Microsoft.Office.Core.CommandBarButton)this.commandBars["Context"].Controls.Add(MsoControlType.msoControlButton,
System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value);
this.toolbarButton2.Caption = "Up";
this.toolbarButton2.Style =
Microsoft.Office.Core.MsoButtonStyle.msoButtonAutomatic;
}

this.toolbarButton2.Tag = "Up";
this.toolbarButton2.Visible = true;
this.toolbarButton2.Priority = 1;
this.toolbarButton2.Enabled = true;


}

Am i missing something?


Ken Slovak - said:
Use the .Update event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top