Microsoft KB Archive/931419

From BetaArchive Wiki
Knowledge Base

BUG: The XDocumentOpen event does not occur in an Office InfoPath 2007 managed add-in if you open an InfoPath 2007 form directly from Windows Explorer

Article ID: 931419

Article Last Modified on 2/5/2007


  • Microsoft Office InfoPath 2007


Consider the following scenario. You create a Microsoft Office InfoPath 2007 managed add-in. The add-in has code that executes on the XDocumentOpen event. You open a saved InfoPath XML file directly from Microsoft Windows Explorer by double-clicking a saved InfoPath XML file. In this scenario, the XDocumentOpen event does not occur.

Note If you first start InfoPath and then you open the form from Windows Explorer, the XDocumentOpen event occurs.


Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.


Steps to reproduce the issue

  1. Use Microsoft Visual Studio Tools for Office System (VSTO) to create an InfoPath add-in.
  2. Add the following line of code to the Startup event handler:

    InfoPath.ApplicationEventsClass events = (InfoPath.ApplicationEventsClass)((InfoPath._Application3)Application).Events;
                    events.XDocumentOpen += new Microsoft.Office.Interop.InfoPath._ApplicationEvents_XDocumentOpenEventHandler(events_XDocumentOpen);
  3. Add the following event handler code example.

    void events_XDocumentOpen(Microsoft.Office.Interop.InfoPath._XDocument pDocument)
  4. Right-click the setup project, and then select Install.
  5. Press F5.
  6. Create a new template, and then save the template.
  7. Open the template, and then save the generated form.
  8. Open the form by double-clicking the form in Windows Explorer.

    The message box does not appear.

Additional query words: IP2007 InfoPath2007

Keywords: kbpending kbbug kbexpertiseinter kbtshoot KB931419