A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Add Item to Context Menu



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 5th 08, 12:31 PM posted to microsoft.public.outlook.program_forms
Muppidi
external usenet poster
 
Posts: 7
Default Add Item to Context Menu

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.
Ads
  #2  
Old November 5th 08, 03:00 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Add Item to Context Menu

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" wrote in message
...
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.


  #3  
Old November 6th 08, 04:54 AM posted to microsoft.public.outlook.program_forms
Muppidi
external usenet poster
 
Posts: 7
Default Add Item to Context Menu

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" wrote in message
...
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.



  #4  
Old November 6th 08, 02:07 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Add Item to Context Menu

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" wrote in message
...
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.


  #5  
Old November 7th 08, 12:38 PM posted to microsoft.public.outlook.program_forms
Muppidi
external usenet poster
 
Posts: 7
Default Add Item to Context Menu

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.msoContr olButton)
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
  #6  
Old November 7th 08, 03:15 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Add Item to Context Menu

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" wrote in message
...
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.msoContr olButton)
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


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
add item to context menu Muppidi Outlook - Using Forms 0 November 5th 08 12:30 PM
add item to context menu Muppidi Outlook - Using Forms 0 November 5th 08 12:18 PM
add new item in context menu Muppidi Outlook - Using Forms 0 November 5th 08 12:16 PM
Add Item in Context Menu Muppidi Outlook - Using Forms 0 November 5th 08 12:13 PM
Get context of context menu sublimese Add-ins for Outlook 1 October 17th 07 05:57 AM


All times are GMT +1. The time now is 10:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.