none
Capture a command event from a shortcut key press RRS feed

  • Question

  • I am looking for a way to handle any possible Reply event triggered by a user's interaction with the Outlook UI. To do this I have repurposed the idMso Reply and ReplyAll Ribbon commands. This works well when the Ribbon commands are used to reply to a message in the Explorer or any Inspector window (and even on the right-click item context menu).

    However, users can also reply to a message through the Ctrl-R keyboard shortcut. The problem is that this does not raise a Ribbon command event (at least not on the idMso Reply/ReplyAll commands).

    Is there a way to capture the relevant shortcut keypress?

    Or better still is there a completely global way of capturing the Reply event in a single handler (a stretch, I know).

    Saturday, March 3, 2012 1:44 PM

Answers

  • Hi Hamish,

    Thanks for posting in the MSDN Forum.

    It's based on my experience that you need Win32 API to address your goal.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, March 5, 2012 6:00 AM
    Moderator

All replies

  • Hi Hamish,

    Thanks for posting in the MSDN Forum.

    It's based on my experience that you need Win32 API to address your goal.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, March 5, 2012 6:00 AM
    Moderator
  • Consider tracking changes in Explorer's Selection (SelectionChange on explorer) object and for each selected object attach to events like Reply, ReplyAll. This way you should handle all situations, disregarding origins - Ribbon, keyboard, etc. Of course remember to detach from events on object deselected.
    Monday, March 5, 2012 10:05 AM
  • Thanks for the reply Damian - yes, in fact I do currently capture Item reply events through Explorer and Inspector wrappers and also by monitoring the ItemContextMenu event too. However I do have a small issue with this method as detailed in this post (if you have any ideas :) ):

    http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/e725d543-5734-4eda-aeaf-ea82d172ff09

    Someone suggested handling the Ribbon commands instead and it sounded like a neat solution; only having to handle the command being raised at a single point, without the need for wrapper and without multiple events being fired for the one reply.

    Anyway, thanks for the info.

    Tuesday, March 6, 2012 12:15 PM
  • maybe let's try from other angle - why do you need to handle those events? and do you need your code to run before replay window is shown or can it be done after replay is composed and sent?
    Tuesday, March 6, 2012 1:44 PM
  • I need to capture the the reply event so I can make changes to the response based on information that is contained in the original item. I need to do this for any possible reply mechanism that a user can perform. As far as I can tell, the reply event is the only location I can do this - i.e. know that it is a reply, what the original item is and what the Reply mesage will be.

    - There is a MailItem A (that I have instantiated in a wrapper through the wrapping logic)

    - Someone hits the Reply button for A

    - Outlook generates the the reply item as Response A and then fires the Reply event for the instance of A with the Response A as an argument to the event handler

    - When the event handler fires, I know it is a Reply and need to do some processing

    - I know what the original item is; A the MailItem stored in the instance of the wrapper for which the handler is running). I then look for some information in this message

    - I also know what the Reply message is: Response A passed in as an argument to the event handler. I then make some changes to Response A based on the information found in A before Response A is displayed on screen

    Tuesday, March 6, 2012 2:18 PM
  • You can always get the parent of a message reply by getting the ConversationTopic and ConversationIndex.The parent message would have the same ConversationTopic and its ConversationIndex value would be 1 time stamp shorter. A time stamp is an 8 byte time/date value. See if that helps.

    --
    Ken Slovak
    [MVP - Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Hamish Anderson" <=?utf-8?B?SGFtaXNoIEFuZGVyc29u?=> wrote in message news:1f2ce0d1-e1ba-480e-8083-42491c258f94...

    I need to capture the the reply event so I can make changes to the response based on information that is contained in the original item. I need to do this for any possible reply mechanism that a user can perform. As far as I can tell, the reply event is the only location I can do this - i.e. know that it is a reply, what the original item is and what the Reply mesage will be.

    - There is a MailItem A (that I have instantiated in a wrapper through the wrapping logic)

    - Someone hits the Reply button for A

    - Outlook generates the the reply item as Response A and then fires the Reply event for the instance of A with the Response A as an argument to the event handler

    - When the event handler fires, I know it is a Reply and need to do some processing

    - I know what the original item is; A the MailItem stored in the instance of the wrapper for which the handler is running). I then look for some information in this message

    - I also know what the Reply message is: Response A passed in as an argument to the event handler. I then make some changes to Response A based on the information found in A before Response A is displayed on screen


    Ken Slovak MVP - Outlook
    Tuesday, March 6, 2012 3:44 PM
    Moderator
  • Thanks Ken, I'll look into that.
    Thursday, March 8, 2012 4:50 PM