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

353 views Asked by At

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

There are 1 answers

2
Eugene Astafiev On BEST ANSWER

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: