PC Review


Reply
Thread Tools Rate Thread

Add Item to Context Menu

 
 
Muppidi
Guest
Posts: n/a
 
      5th Nov 2008
Hi

i need to addd an item to the existinfg Context Menu (right click on
outloook mail)

the item should be "Status" and its sub-items are "Approve" & "Reject"

Upon selecting "Approve", i should be able to update a field in my databse
to 1 (and 0 for "Reject")

any help....?

i'm using Outlook 2007, VS 2005.

Thanks & Regards,
Muppidi.
 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      5th Nov 2008
At least in this copy of your 5 messages posted here with the same question
you finally provided the needed information on your Outlook version. One
post would have been enough.

Using Outlook 2007 you can use the Application.ItemContextMenuDisplay()
event to add your custom menu entry. Open the Outlook 2007 VBA project and
in the Object Browser select that event and click F1 for more information on
how to use that event.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Muppidi" <(E-Mail Removed)> wrote in message
news:8A4C461D-A62C-48E1-B463-(E-Mail Removed)...
> Hi
>
> i need to addd an item to the existinfg Context Menu (right click on
> outloook mail)
>
> the item should be "Status" and its sub-items are "Approve" & "Reject"
>
> Upon selecting "Approve", i should be able to update a field in my databse
> to 1 (and 0 for "Reject")
>
> any help....?
>
> i'm using Outlook 2007, VS 2005.
>
> Thanks & Regards,
> Muppidi.


 
Reply With Quote
 
Muppidi
Guest
Posts: n/a
 
      6th Nov 2008
Sorry Ken.
I got connection failure error when i was trying to post this.
i've made 5 attempts and the final one worked out.
but after that i saw 5 queries were posted.
did not find any link to delete the extra queries.

Coming to the point.
i'm getting VBA sample code thru google.
can u suggest a link or some sample code to use ItemContextMenuDisplay thru
C# or VB.Net.
Thanks & Regards,
Muppidi.


"Ken Slovak - [MVP - Outlook]" wrote:

> At least in this copy of your 5 messages posted here with the same question
> you finally provided the needed information on your Outlook version. One
> post would have been enough.
>
> Using Outlook 2007 you can use the Application.ItemContextMenuDisplay()
> event to add your custom menu entry. Open the Outlook 2007 VBA project and
> in the Object Browser select that event and click F1 for more information on
> how to use that event.
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Muppidi" <(E-Mail Removed)> wrote in message
> news:8A4C461D-A62C-48E1-B463-(E-Mail Removed)...
> > Hi
> >
> > i need to addd an item to the existinfg Context Menu (right click on
> > outloook mail)
> >
> > the item should be "Status" and its sub-items are "Approve" & "Reject"
> >
> > Upon selecting "Approve", i should be able to update a field in my databse
> > to 1 (and 0 for "Reject")
> >
> > any help....?
> >
> > i'm using Outlook 2007, VS 2005.
> >
> > Thanks & Regards,
> > Muppidi.

>
>

 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      6th Nov 2008
I don't know any links to managed code for that event handler, but it's
trivial to translate VBA code to VB.NET code. You can also look at the
sample addins from MS on the Office developer site, those are in both VB.NET
and C# and if I recall correctly the sample one for the rules addin and
maybe the travel agency one have context menu code.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Muppidi" <(E-Mail Removed)> wrote in message
news:C18587CF-09D2-44C8-A5D5-(E-Mail Removed)...
> Sorry Ken.
> I got connection failure error when i was trying to post this.
> i've made 5 attempts and the final one worked out.
> but after that i saw 5 queries were posted.
> did not find any link to delete the extra queries.
>
> Coming to the point.
> i'm getting VBA sample code thru google.
> can u suggest a link or some sample code to use ItemContextMenuDisplay
> thru
> C# or VB.Net.
> Thanks & Regards,
> Muppidi.


 
Reply With Quote
 
Muppidi
Guest
Posts: n/a
 
      7th Nov 2008
HI
i was able to debug without any errors now.
but this is just opening the outlook and going out of debug mode.
thats it.
its not hitting the break points.
i'm using only the ItemContextMenuDisplay event only.
how to go into debug mode and check whether the selected item's context menu
is getting added with my customized item.

this is the code:

Private Sub Application_ItemContextMenuDisplay(ByVal CommandBar As
Office.CommandBar, ByVal Selection As Outlook.Selection)

Static intCounter As Integer

On Error GoTo ErrRoutine

' Increment or reset the counter
If intCounter < 1 Or intCounter > 100 Then
intCounter = 1
Else
intCounter = intCounter + 1
End If

' Add the menu.
Dim objMenu As Microsoft.Office.Core.CommandBarControl
Dim cmbBar As Microsoft.Office.Core.CommandBar

objMenu = cmbBar.Controls.Add(Office.MsoControlType.msoControlButton)
objMenu.Caption = "Displayed " & intCounter & " times"
objMenu.Enabled = True
objMenu.BeginGroup = True

EndRoutine:
On Error GoTo 0
Exit Sub

ErrRoutine:
MsgBox(Err.Number & " - " & Err.Description, _
vbOKOnly Or vbCritical, _
"Application_ItemContextMenuDisplay")

GoTo EndRoutine
End Sub

please tell me what i'm missing.
what else events i need to add...?
i've given the references to Outlook 11.0 & 12.0 dlls and also to Office dll
also.
still i'm not able to see my item in the context menu.
waiting for ur reply.

Thanks & regards,
Muppidi
 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      7th Nov 2008
Where are you running this code, it looks like it's in a VS project? How are
you adding the event handler?

If you aren't getting compilation errors then you don't need any additional
references. If your event handler isn't being called I'd suspect it isn't
being added correctly.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Muppidi" <(E-Mail Removed)> wrote in message
news:BE278FE2-64AD-4374-9B50-(E-Mail Removed)...
> HI
> i was able to debug without any errors now.
> but this is just opening the outlook and going out of debug mode.
> thats it.
> its not hitting the break points.
> i'm using only the ItemContextMenuDisplay event only.
> how to go into debug mode and check whether the selected item's context
> menu
> is getting added with my customized item.
>
> this is the code:
>
> Private Sub Application_ItemContextMenuDisplay(ByVal CommandBar As
> Office.CommandBar, ByVal Selection As Outlook.Selection)
>
> Static intCounter As Integer
>
> On Error GoTo ErrRoutine
>
> ' Increment or reset the counter
> If intCounter < 1 Or intCounter > 100 Then
> intCounter = 1
> Else
> intCounter = intCounter + 1
> End If
>
> ' Add the menu.
> Dim objMenu As Microsoft.Office.Core.CommandBarControl
> Dim cmbBar As Microsoft.Office.Core.CommandBar
>
> objMenu =
> cmbBar.Controls.Add(Office.MsoControlType.msoControlButton)
> objMenu.Caption = "Displayed " & intCounter & " times"
> objMenu.Enabled = True
> objMenu.BeginGroup = True
>
> EndRoutine:
> On Error GoTo 0
> Exit Sub
>
> ErrRoutine:
> MsgBox(Err.Number & " - " & Err.Description, _
> vbOKOnly Or vbCritical, _
> "Application_ItemContextMenuDisplay")
>
> GoTo EndRoutine
> End Sub
>
> please tell me what i'm missing.
> what else events i need to add...?
> i've given the references to Outlook 11.0 & 12.0 dlls and also to Office
> dll
> also.
> still i'm not able to see my item in the context menu.
> waiting for ur reply.
>
> Thanks & regards,
> Muppidi


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add image to Context Menu Strip Menu Item in code Joe Cool Microsoft C# .NET 2 29th Jul 2009 02:16 AM
add item to context menu Muppidi Microsoft Outlook Form Programming 0 5th Nov 2008 12:30 PM
add item to context menu Muppidi Microsoft Outlook Form Programming 0 5th Nov 2008 12:18 PM
Context Menu Item Ryan Windows Vista General Discussion 0 23rd Jan 2008 07:31 PM
Context menu item John Baro Microsoft C# .NET 0 26th Jul 2003 08:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:51 PM.