none
Custom menu items dissapear on application restart RRS feed

  • Question

  • Hi All,

    I have been creating an outlook add-in for a web-service-based mail system (please see my previous threads in regards - but kind of unrelated to this issue). In it, I am creating menu items for the user to access the different mail options on the different servers. These menu items may vary from server to server, so I am creating them dynamically from a row list in a DataTable. So the final menu structure would be something like the following:

    <Top-level button (on standard toolbar)>
     - <refresh mails button>
     - <"select option">
         - <server 1>
            - <option a>
            - <option b>
            - <option c>
         - <server 2>
            - <option b>
            - <option c>
            - <option d>

    The 'top-level button', 'select option' and 'server 1/2' buttons are drop-down menus. All the menu items get created successfully on the first-run, but when outlook is closed and re-opened, the 'option' buttons are no longer there on ONE of the server drop-down menus. This happens only for ONE of the server-level menus, but the server-level menu button itself is still there.

    Theoretically, I should be able to simply re-create the sub-menu 'option' buttons, but when retrieving the reference to the "server" CommandBarButton and then cast it to a CommandBar, an error is thrown.

    Has anyone come across this issue where 3rd level sub-menu items are 'removed' on outlook shutdown/start up? Is there a solution for this?

    Tuesday, January 15, 2013 11:39 PM

Answers

  • You shouldn't be creating any CommandBar interface on anything other than a temporary basis. In fact the normal recommendation is to set the Temporary argument to true and to also delete any existing CommandBar UI when the Explorer or Inspector is closed. On startup or when an Explorer or Inspector is opened you then create your UI.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Thimila Fernando" <=?utf-8?B?VGhpbWlsYSBGZXJuYW5kbw==?=> wrote in message news:4fdece9e-4144-439f-9925-5b0459ebef16...

    Hi All,

    I have been creating an outlook add-in for a web-service-based mail system (please see my previous threads in regards - but kind of unrelated to this issue). In it, I am creating menu items for the user to access the different mail options on the different servers. These menu items may vary from server to server, so I am creating them dynamically from a row list in a DataTable. So the final menu structure would be something like the following:

    <Top-level button (on standard toolbar)>
     - <refresh mails button>
     - <"select option">
         - <server 1>
            - <option a>
            - <option b>
            - <option c>
         - <server 2>
            - <option b>
            - <option c>
            - <option d>

    The 'top-level button', 'select option' and 'server 1/2' buttons are drop-down menus. All the menu items get created successfully on the first-run, but when outlook is closed and re-opened, the 'option' buttons are no longer there on ONE of the server drop-down menus. This happens only for ONE of the server-level menus, but the server-level menu button itself is still there.

    Theoretically, I should be able to simply re-create the sub-menu 'option' buttons, but when retrieving the reference to the "server" CommandBarButton and then cast it to a CommandBar, an error is thrown.

    Has anyone come across this issue where 3rd level sub-menu items are 'removed' on outlook shutdown/start up? Is there a solution for this?


    Ken Slovak MVP - Outlook
    Wednesday, January 16, 2013 3:10 PM
    Moderator

All replies

  • show us code for creating those menus with options
    Wednesday, January 16, 2013 7:27 AM
  • You shouldn't be creating any CommandBar interface on anything other than a temporary basis. In fact the normal recommendation is to set the Temporary argument to true and to also delete any existing CommandBar UI when the Explorer or Inspector is closed. On startup or when an Explorer or Inspector is opened you then create your UI.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Thimila Fernando" <=?utf-8?B?VGhpbWlsYSBGZXJuYW5kbw==?=> wrote in message news:4fdece9e-4144-439f-9925-5b0459ebef16...

    Hi All,

    I have been creating an outlook add-in for a web-service-based mail system (please see my previous threads in regards - but kind of unrelated to this issue). In it, I am creating menu items for the user to access the different mail options on the different servers. These menu items may vary from server to server, so I am creating them dynamically from a row list in a DataTable. So the final menu structure would be something like the following:

    <Top-level button (on standard toolbar)>
     - <refresh mails button>
     - <"select option">
         - <server 1>
            - <option a>
            - <option b>
            - <option c>
         - <server 2>
            - <option b>
            - <option c>
            - <option d>

    The 'top-level button', 'select option' and 'server 1/2' buttons are drop-down menus. All the menu items get created successfully on the first-run, but when outlook is closed and re-opened, the 'option' buttons are no longer there on ONE of the server drop-down menus. This happens only for ONE of the server-level menus, but the server-level menu button itself is still there.

    Theoretically, I should be able to simply re-create the sub-menu 'option' buttons, but when retrieving the reference to the "server" CommandBarButton and then cast it to a CommandBar, an error is thrown.

    Has anyone come across this issue where 3rd level sub-menu items are 'removed' on outlook shutdown/start up? Is there a solution for this?


    Ken Slovak MVP - Outlook
    Wednesday, January 16, 2013 3:10 PM
    Moderator
  • Thanks Damian, but the issue was resolved.

    Although I am not sure why or how, the issue stopped appearing after I resolved an issue I had with Outlook process not stopping (The issue described here). I am thinking of removing the menu items at shutdown and completely recreating them at startup anyhow.

    Thanks again!

    Thursday, January 17, 2013 7:02 AM