none
Outlook 2010 - Dynamic Menu - getContent callback function is not called RRS feed

  • Question

  • Hi all!

    First, I am sorry, if this is posted to wrong forum, but I could not find a better Forum.

    I am trying to develop an Outlook 2010 add-in with Visual Studio 6. In general it is working fine, but I am facing one issue with "getContent" callback. This function is not fired.

    Below is the Ribbon XML (the code is from some MSDN page, with little changes made by myself) which is creating some items in right-click menu, when right-clicking an Outlook contact item. This is working fine, but dynamic menu is not created, because the callback function (in my case) "GetMyContent" is not called.

    <customUI onLoad="Ribbon_OnLoad" xmlns="http://schemas.microsoft.com/office/2009/07/customui">
      <contextMenus>
       <contextMenu idMso="ContextMenuContactItem">
         <button idMso="FontDialog" visible="false" />
         <toggleButton id="MyToggle" label="My Toggle Button" />
         <button id="MyButton" label="My Button" insertBeforeMso="HyperlinkInsert" onAction="GetButtonID" />
         <menuSeparator id="MySeparator" />
         <menu id="MySubMenu" label="My Submenu" >
          <button id="MyButton2" label="Button on submenu" />
         </menu>
         <gallery id="galleryOne" label="My Gallery">
          <item id="item1" imageMso="HappyFace" />
          <item id="item2" imageMso="HappyFace" />
          <item id="item3" imageMso="HappyFace" />
          <item id="item4" imageMso="HappyFace" />
         </gallery>
         <dynamicMenu id="MyDynamicMenu" label= "My Dynamic Menu" getContent="GetMyContent" />
       </contextMenu>
      </contextMenus>
    </customUI>

    And here is the VB6 function resp. sub, which should be called. It is not called and I am frustrated, because I cannot see the issue ;)

     

     

    Public Sub GetMyContent(control As IRibbonControl, ByRef content)
    Dim xmlString As String
    xmlString = "<menu xmlns=""" & _
    "http://schemas.microsoft.com/office/2006/01/customui"">"
    xmlString = xmlString & "<button id=""btn1"" imageMso=""HappyFace"" " & _
    " label=""Click Me"" onAction=""btnAction"" />"
    xmlString = xmlString & "<menu id=""mnu"" label=""My Dynamic Menu"" > " & _
    "<button id=""btn2"" imageMso=""RecurrenceEdit"" /> " & _
    "<button id=""btn3"" imageMso=""CreateReportFromWizard"" /> " & _
    "</menu>"
    content = xmlString & "</menu>"

    End Sub

     

    I hope somebody can help. Thanks in advance!

    best regards

    Wednesday, May 5, 2010 11:39 AM

Answers

  • Hello,

    <<Below is the Ribbon XML (the code is from some MSDN page, with little changes made by myself) which is creating some items in right-click menu, when right-clicking an Outlook contact item.>>
    Sorry for delay. What do you mean Visaul Studio 6.0? write this callback in Visual Basic editor by pressing Alt+ F11? I have also made a test in my side, and writing this callback in VBE does not make this sub called. When right clicking a contact item, and click My Dynamic Menu, it will call the callback in Ribbon.cs file.  I create a Outlook 2010 Add-in(Visual Studio 2010 and Office 2010), and write this callback in Ribbon.cs file. This add-in in my side works fine. I upload this add-in here. Please download this add-in and see if there is a difference between us.

    Best regards,
    Bessie

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Bessie Zhao Wednesday, May 12, 2010 1:49 AM
    Monday, May 10, 2010 6:22 AM
  •  

    Hi,

    thanks for your reply.

    This problem is already solved, but I had not time to answer yet, sorry.

    The only problem was that the CallBack "function" was wrong. I think my function resp. sub above is for Outlook 2007 or VBA or whatever. I changed my function to the code below, and then everything was working fine (For sure the name of the function must be also changed in xml above, because it is now named 'getCallToMenu').

    The first thing is that it must be a FUNCTION not a SUB, the second thing is that there is no need for the second parameter "ByRef content"


     

    Public Function getCallToMenu(control As IRibbonControl)
     
     'some code
    
     getCallToMenu = "... my xml code ..."
    
    End Function

     

    Your example is also working fine.

     

    Thanks, regards
    Freezer

     

    • Marked as answer by Bessie Zhao Thursday, May 13, 2010 1:55 AM
    Wednesday, May 12, 2010 2:19 PM

All replies

  • Hello,

    <<Below is the Ribbon XML (the code is from some MSDN page, with little changes made by myself) which is creating some items in right-click menu, when right-clicking an Outlook contact item.>>
    Sorry for delay. What do you mean Visaul Studio 6.0? write this callback in Visual Basic editor by pressing Alt+ F11? I have also made a test in my side, and writing this callback in VBE does not make this sub called. When right clicking a contact item, and click My Dynamic Menu, it will call the callback in Ribbon.cs file.  I create a Outlook 2010 Add-in(Visual Studio 2010 and Office 2010), and write this callback in Ribbon.cs file. This add-in in my side works fine. I upload this add-in here. Please download this add-in and see if there is a difference between us.

    Best regards,
    Bessie

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Bessie Zhao Wednesday, May 12, 2010 1:49 AM
    Monday, May 10, 2010 6:22 AM
  •  

    Hi,

    thanks for your reply.

    This problem is already solved, but I had not time to answer yet, sorry.

    The only problem was that the CallBack "function" was wrong. I think my function resp. sub above is for Outlook 2007 or VBA or whatever. I changed my function to the code below, and then everything was working fine (For sure the name of the function must be also changed in xml above, because it is now named 'getCallToMenu').

    The first thing is that it must be a FUNCTION not a SUB, the second thing is that there is no need for the second parameter "ByRef content"


     

    Public Function getCallToMenu(control As IRibbonControl)
     
     'some code
    
     getCallToMenu = "... my xml code ..."
    
    End Function

     

    Your example is also working fine.

     

    Thanks, regards
    Freezer

     

    • Marked as answer by Bessie Zhao Thursday, May 13, 2010 1:55 AM
    Wednesday, May 12, 2010 2:19 PM