How to capture “Print Tab” click event at the backstage in Outlook 2010 ?

大城市里の小女人 提交于 2019-12-11 19:35:34

问题


I want to capture the click events in "TabPrint" at the backstage of outlook 2010.

Followint is what I have done so far

I have defined a custom UI in xml as following. I have directed every event to one method (which is OnPrintClick)

 <?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <commands>    
    <!-- Mail print related -->
    <command idMso="FilePrint" onAction="OnPrintClick"/>
    <command idMso="FilePrintCustomRange" onAction="OnPrintClick"/>
    <command idMso="FilePrintPreview" onAction="OnPrintClick"/>
    <command idMso="FilePrintQuick" onAction="OnPrintClick"/>
    <command idMso="GroupPrint" onAction="OnPrintClick"/>
    <command idMso="GroupPrintPreview" onAction="OnPrintClick"/>
    <command idMso="GroupPrintProtectedView" onAction="OnPrintClick"/>
    <command idMso="GroupPrintSettings" onAction="OnPrintClick"/>
    <command idMso="PrintCategory" onAction="OnPrintClick"/>
    <command idMso="PrintDialogAccess" onAction="OnPrintClick"/>
  </commands>
</customUI>

The OnPrintClick method is located in the Connect class in the solution. Following are the parameters which are accepted by this method.

 public void OnPrintClick(IRibbonControl control , ref bool cancel)
    {
        MessageBox.Show("PRINT !");
    }

When I execute this code, it does not capture any of the the click events which I have defined. Is there something that I am doing wrong here ? Any help would be appreciated.


回答1:


The command tag will not play any role in case of backstage UI controls. You can repurpose only controls on the ribbon (not backstage). See Temporarily Repurpose Commands on the Office Fluent Ribbon for more information.

A possible solution would be to consider hiding the built-in UI and rebuilding it fully with custom commands. Read more about the Backstage UI in the following series of articles in MSDN:

  • Customizing the Office 2010 Backstage View for Developers
  • Introduction to the Office 2010 Backstage View for Developers


来源:https://stackoverflow.com/questions/30837228/how-to-capture-print-tab-click-event-at-the-backstage-in-outlook-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!