none
Form regions aren't instantiated when starting Outlook with /c ipm.note /m _email_ RRS feed

  • Question

  • I've made an Outlook addin and the form region starts OK when you use "New Email" from within Outlook. However, when an Inspector is created more directly, such as by clicking a "mailto" URL or when using the command line, e.g.:

    outlook.exe /c ipm.note /m "stuart@example.com"

    Then the form region isn't created. In fact, according to the breakpoints I set in the debugger, the FormRegionFactory isn't even instantiated, let alone getting to the FormRegionInitializing event. The Inspector is created and detected in the usual way. 

    [EDIT: Well, it is instantiated, but very late. About 8 seconds after the Inspector window appears, the FormRegionFactory does finally get instantiated, but the FormRegionInitializing is still not triggered. Accessing Globals.FormRegions does get the factory constructor called much sooner, but still has no impact on making the form region itself get constructed.]

    [EDIT AGAIN: I've made a test repo at: https://bitbucket.org/morungos/outlookaddin1. There are two configurations, one for debug running as above, and the other as normal directly into an explorer. This replicates the lack of form region when directly from command line.]

    [EDIT PART THREE: I've also seen that when started in command-line mode, the "Configure advanced custom forms options" option (under Advanced) is disabled for some reason. So it looks as if Outlook might simply disable all forms when started in this mode. This isn't documented, so I'd be keen if anyone can confirm or explain this.]

    I'm wondering if there are some additional registry settings needed, or something else that's missing for when an Inspector is started directly from the command line. A quick test with procmon.exe (which I am not expert with) does seem to show the FormRegion registry settings are being read OK. And the add-in is definitely running. 

    Any thoughts or suggestions?





    • Edited by morungos Friday, May 4, 2018 8:29 PM
    Friday, May 4, 2018 4:13 PM

Answers

  • Hi morungos,

    I made a test and I could get the same result.

    It seems the Inspector shows before add in load, and it failed to show the FormRegion. If you run Outlook application first, or after the command “outlook.exe /c ipm.note /m "stuart@example.com"” show inspector, run again this command, the second inspector will have form region.

    Since we could not control the add in loadup time to before the Inspector shows, I am afraid there is no way in VSTO API.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by morungos Friday, May 18, 2018 3:58 PM
    Wednesday, May 9, 2018 7:20 AM

All replies

  • Hello,

    I have got the same results with VSTO based add-ins - an Outlook form region is not displayed when Outlook is started with the specified command line arguments or just using the mailto: command.

    The fact is that the sequence of event handlers is not preserved when the inspector window is displayed to a user. You need at startup time check whether an add-in is initialized fully and any explorer window exists to show the pane programmatically.

    FYI I have just checked whether such cases are handled correctly with Add-in Express. They cover such scenarios in advance so the pane is displayed with your command line. Read more about Outlook forms on the Advanced Outlook view and form regions page.


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Monday, May 7, 2018 1:54 AM
  • That's a great start, Eugene. I don't have Add-in Express yet (this might get me to switch, but that'll be a block of time on the roadmap, as there's quite a bit built now).

    Any quick pointers to the parts of the VSTO API that can help with the programmatic display as a short term work-around? 

    Monday, May 7, 2018 7:41 PM
  • Hi morungos,

    I made a test and I could get the same result.

    It seems the Inspector shows before add in load, and it failed to show the FormRegion. If you run Outlook application first, or after the command “outlook.exe /c ipm.note /m "stuart@example.com"” show inspector, run again this command, the second inspector will have form region.

    Since we could not control the add in loadup time to before the Inspector shows, I am afraid there is no way in VSTO API.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by morungos Friday, May 18, 2018 3:58 PM
    Wednesday, May 9, 2018 7:20 AM
  • I've marked the answer here as being (a) in standard VSTO this is how it is, but note that Add-in Express does work around the issue. 
    Friday, May 18, 2018 3:59 PM