问题
Outlook 2010 has a feature called Convesation Cleanup. This feature is implemented using the Conversation Header Outlook Object Model.
I would like to hook to this call and perform an action when triggered, yet I can't figure out how to catch it/hook on to it. Is anyone aware if this is possible? If its not, are you aware of any way around it? I have tried using outlook spy to view the event log when executing 'conversation cleanup' with no luck (nothing logged)... is there anyway of viewing deeper tracing of outlook events?
回答1:
It turns out to be quite simple. The initial step is to obtain the idMso
of the desired button to override. Microsoft provides a list of all the control ids for the Office suite however I found faster and more user friendly way of obtaining the idMso.
- Office Button/File -> Options -> Customize Ribbon -> Hover mouse on desired command - idMso is displayed in brackets
Once we have the desired ids, we edit the Ribbon.xml by adding a set of commands to override the onAction/Enable settings of the button. See example bellow;
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<commands>
<command idMso="IgnoreConversation" onAction ="FooRoutine" enabled="true"/>
</commands>
<ribbon>
</ribbon>
</customUI>
Last, we create the desired function on the Ribbon.vb which will be executed once the button is pressed.
I strongly suggest that you watch the 8 minute MSDN video where the steps above have been very well explained.
来源:https://stackoverflow.com/questions/7600181/outlook-object-model-hooking-to-the-conversation-cleanup-feature