none
How to handle "Show as conversation" in outlook RRS feed

  • Question

  • HI All,

    We are writing a VSTO plugin for outlook 2013 and onwards in C#. We want to handle event on click of checkbox "Show as Conversations" (in view tab) and want to block the current flow and execute our customized flow.

    We have tried following steps in RibbonExplorer.xml

    <command idMso="ShowInConversations" onAction="OnAction_ShowConversation" />

    My API implementation is as below :--

        public void OnAction_ShowConversation(IRibbonControl control, bool pressed)
        {
          MessageBox.Show("In conversation");
        }

    But instead of getting message, this checkbox is not allowing user to select this option at all (as soon as we check it, it automatically gets unchecked).

    I have tried some other ways like :--

          <tab idMso="TabView">
            <group idMso="GroupConversations">
              <checkBox
                idMso="ShowInConversations" 
                getDescription="GetConversationDescription"
                getScreentip="GetConversationDescription"
                onAction="OnAction_ShowConversation"
                />
            </group>
          </tab>

    But it is also not working. Can somebody please suggest a right way to handle it ?

    Thanks

    Dev

    Thursday, January 31, 2019 8:54 AM

Answers

  • I played around with this some more and the following IDL method for a C++ native add-in allowed the repurposed control to function-

    [id(77), helpstring("ShowInConversations")] HRESULT OnShowInConversations([in] IDispatch *pControl, [in] VARIANT_BOOL *pvarfPressed, [in,out] VARIANT *pCancel);
    

    Thursday, January 31, 2019 7:52 PM
  • I could repurpose this control. However one issue I am still facing that when I select the checkbox, it still goes unchecked after executing my API. even if I am setting cancelDefault as true and want the flow to be executed.

    Can you suggest something ?

    Don't repurpose the control.  Instead, hide Outlooks Conversations group on the View tab and replace it with your own group.  For example, my test ribbon xml looked like --

    <tab idMso="TabView">
      <group idMso="GroupConversations" visible="false" />
      <group id="Conv" label="Conversations" insertAfterMso="GroupCurrentView">
        <box id="box2" boxStyle="vertical" >
          <checkBox id="MyConv" label="Show as Conversations" screentip="Invoke add-in method" onAction="OnMyShowInConversations" />
          <menu idMso="ConversationsMenu" label="Conversation Settings" />
        </box>
      </group>
    </tab>
    

    So when the checkbox was clicked, the result was -

    and when the dialog was dismissed the checkbox remained checked --

    Proper checkbox state was maintained when unchecking.

    Saturday, February 2, 2019 3:02 PM

All replies

  • Have you tried to provide getPressed callback?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, January 31, 2019 5:13 PM
  • For what its worth, my version of Outlook issues a Custom UI error for mismatched callback signature for this control when it is repurposed with the standard OnAction for a checkbox.
    Thursday, January 31, 2019 7:25 PM
  • Select the "Show add-in user interface errors" check box to find out if your Ribbon XML contains errors. See File | Options | Advanced. This should be done via a Ribbon Command element properly adjusted, not via Checkbox; make sure the event handler is of the correct signature. The second XML above should produce a message: you cannot customize a built-in Ribbon group.

    Regards from Belarus (GMT + 3),

    Andrei Smolin
    Add-in Express Team Leader

    Please mark answers and useful posts to help other developers use the forums efficiently.

    Thursday, January 31, 2019 7:35 PM
  • I played around with this some more and the following IDL method for a C++ native add-in allowed the repurposed control to function-

    [id(77), helpstring("ShowInConversations")] HRESULT OnShowInConversations([in] IDispatch *pControl, [in] VARIANT_BOOL *pvarfPressed, [in,out] VARIANT *pCancel);
    

    Thursday, January 31, 2019 7:52 PM
  • HI RLWA32 / Dmitry / Andrei,

    Thanks for your response. I have changed the API as per your suggestion. Now it looks like as below :--

        public void OnAction_ShowConversation(IRibbonControl control, bool pressed, ref bool cancelDefault)
        {
          MessageBox.Show("In conversation");
          cancelDefault = false;
        }

    I could repurpose this control. However one issue I am still facing that when I select the checkbox, it still goes unchecked after executing my API. even if I am setting cancelDefault as false and want the flow to be executed.

    Can you suggest something ?

    Thanks

    Dev


    Saturday, February 2, 2019 2:01 PM
  • I could repurpose this control. However one issue I am still facing that when I select the checkbox, it still goes unchecked after executing my API. even if I am setting cancelDefault as true and want the flow to be executed.

    Can you suggest something ?

    Don't repurpose the control.  Instead, hide Outlooks Conversations group on the View tab and replace it with your own group.  For example, my test ribbon xml looked like --

    <tab idMso="TabView">
      <group idMso="GroupConversations" visible="false" />
      <group id="Conv" label="Conversations" insertAfterMso="GroupCurrentView">
        <box id="box2" boxStyle="vertical" >
          <checkBox id="MyConv" label="Show as Conversations" screentip="Invoke add-in method" onAction="OnMyShowInConversations" />
          <menu idMso="ConversationsMenu" label="Conversation Settings" />
        </box>
      </group>
    </tab>
    

    So when the checkbox was clicked, the result was -

    and when the dialog was dismissed the checkbox remained checked --

    Proper checkbox state was maintained when unchecking.

    Saturday, February 2, 2019 3:02 PM