how to capture events for next item

A

Ashish

In outlook 2003, When open a mail there are 2 buttons in statndard menu
which are Next Item and Previous Item (in arrow symbol) in open mail window.
I am not able to capture events for these two buttons. Besides these i can
capture events for other buttons on standard menu. I can not know in my
addin when user click on these buttons. Their ids are 359 and 360.Please
suggest how to capture events for those.
 
H

Heinz-Josef Bomanns

Hallo Ashish,
In outlook 2003, When open a mail there are 2 buttons in statndard menu
which are Next Item and Previous Item (in arrow symbol) in open mail window.
I am not able to capture events for these two buttons. Besides these i can
capture events for other buttons on standard menu. I can not know in my
addin when user click on these buttons. Their ids are 359 and 360.Please
suggest how to capture events for those.

You can try to put references to the two buttons for e.g. in variables
(declared 'As Office.CommandbarButton') "btnID359" and "btnID360",
then hide the buttons (.Visible= False) and add your own buttons with
the same positions and FaceIDs. In the appropriated event procs of
your buttons do what you have to do and finally do call
"btnID359.Execute" or "btnID360.Execute" to run the original
functionallity. Just some theoretical thoughts, but worth a try i
think...
 
A

Ashish

Thanks for this info.

Does it mean it is not possible to capture events for these buttons. Outlook
does not provide that?
 
K

Ken Slovak - [MVP - Outlook]

The problem is you are handling events for a specific
Inspector.CommandBars.CommandBarButton object. Clicking Next or Previous
will open a new Inspector in Outlook 2003.

Why do you need to handle events for those specific button clicks?
 
A

Ashish

Oh it means when we click on nexe/previous item a new inspector open.
Why do you need to handle events for those specific button clicks?

Because when we click on next/previous button outlook first call
onnewinspector while another inspector is not close. After this outlook call
close inspector for another inspector. And the main problem is outlook never
call item_open event for new inspector.
 
A

Ashish

How outlook calls its event when i open a mail and close it

open a mail, outlook call onnewinspector. In this i get
inspector.currentitem and registered events for current item.
Then outlook call item_open event, i add a attachment in current item but do
not call item->Save. Now when mail display it shows an attachment. After
this when i close this mail outlook call item_close. Here i delete that
attachment and call save function. After this outlook call inspector_close.

Now for the case when i click on next/previous item

open a mail, outlook call onnewinspector. In this i get
inspector.currentitem and registered events for current item.
Then outlook call item_open event, i add a attachment in current item but do
not call item->Save. Now when mail display it shows an attachment. When i
click on next button outlook call inspector_close (here it did not call
item_close). Then it call onnewinspector for next mail. After that outlook
call item_close for previous mail. And outlook does not call item_open for
next mail.

I have 2 problems here.
1. For next mail since i do not get item_open event so can not add a
attachment in next mail.
2. Since for this case outlook calls inspector_close event (did not call
item_close event and i add a attachment in mail, means i modify the mail )
so outlook prompts a message "Do you want to save".
Since item_close is not called, In inspector_close i delete attachment from
mail and save it but still outlook displays the message "Do you want to
save".

Thats why i ask how to register events for next/previous button. But since
it's not possible so is there any solution for that problem.
 
K

Ken Slovak - [MVP - Outlook]

I don't really see a solution since you are changing items without saving
them. That will force the prompts. We've gone over various other problems
caused by this structure, about all I can think of other than not adding the
attachments or saving the items is to disable those buttons so they can't be
used.
 
A

Ashish

Previous and next button and popup button. Under Previous/Next button there
are many control buttons. We can capture event for these control buttons not
for these popup button.
Does outlook not support to capture event for a popup button when it's
clicked.
 
K

Ken Slovak - [MVP - Outlook]

There are a number of different commandbar controls that MS uses that
outside programmers can't get at or use ourselves. As I said, I don't see a
solution to get those clicks.
 
S

Sanadeep Yadav

Hi Ashish,

I also had similar problem .. here is the solution which u got after 2 days
RnD :)


include Ribbon xml file : (You will need to customize qat)
<ribbon startFromScratch="true">
<qat>
<sharedControls>
<button idMso="FileSave" />
<button id="PreviousAction" label="Previous"
supertip="Click to view previous email message"
imageMso="MessagePrevious"
onAction="Previous_Action" keytip="C" />
<button id="NextAction" label="Next"
supertip="Click to view next email message"
imageMso="MessageNext"
onAction="Next_Action" keytip="B" />
</sharedControls>
</qat>
</ribbon>


Next_Action()
{
// do your action

//Call following to use default feature of Next arrow

Globals.ThisAddIn.Application.ActiveInspector().CommandBars.ExecuteMso("MessageNext");
}

same goes for previous action ..

Thanks!

Regards,
Sandeep Yadav
..Net Developer
 

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