MoveToFolder Button controls COUNT () API in Outlook object Model return inconsistent data after first time Outlook account is configured. RRS feed

  • Question

  • Code History : 
    We are getting the handle of the MoveToFolder button by looping through “Office.CommandBarControl“  controls. (ctl.Id == 2778 , indicate MoveToFolder).
    Once We got the handle we use controlHandle.Controls.Count API to determine number of controls available under MoveToFolder.

    controlHandle.Controls.Count() API is not getting updated/returning correct value till we relaunch outlook; after mail account is configured.
    This methodology is working fine when we configure outlook and re-launching (second time onwards), but it is having issue when we use very first time after we configured outlook.

    After Outlook is configured, we manually move mails to different folders. Our expectation is, these many folders should be shown in the “MoveToFolder” Controls.Count. But it is showing “0”.

    When we relaunching outlook , API  returns correct count for the number of controls in “MoveToFolder” Controls.

    1. Can anyone please assist, Why “MoveToFolder” Controls.Count() API is returning “0” even though it have the recently used folder names in the in-built “MoveToFolder” List.?

    2. Is there a time delay set by outlook internals to collect and build the buttons?

    3. If there is a time delay, then after that delayed time, the list should be populated. But it is not populating.
    4. Is there a locking mechanism on the MRU list on MovetoFolder buttons when they are populated?
    5. Is there any other API to collect the MRU list from within outlook?

    We modified the code for a trial run to get the MRU list from the Registry but not all the users have permission to query the registry for the MRU list. So this option is not a suitable solution for us.

    Murari S

    Tuesday, January 5, 2016 10:30 AM


All replies