Search code examples
infopathinfopath2010

InfoPath 2010: referencing the XmlFormHostItem class from a stand alone class library?


An InfoPath form inherits from the XmlFormHostItem class. I can use the XmlFormHostItem type in the VSTA 2005 event handler of a Button control. In order to reuse this code, I wish to do the same from a stand alone class library.

Details: Microsoft.Office.InfoPath.XmlFormHostItem Assembly: Microsoft.Office.InfoPath, Version=14.0.0.0

I can reference the assembly Microsoft.Office.InfoPath (as a PIA library) from the stand alone class library, but the XmlFormHostItem type is not available.


Solution

  • Solved by referencing the assembly located at

    C:\Program Files\Microsoft Office\Office14\InfoPathOM\Microsoft.Office.Infopath.dll
    

    it turned out there are a multiple Microsoft.Office.InfoPath assemblies exposing a partial or full InfoPath feature set.

    More information on MSDN: Understanding InfoPath Object Models and Development Environment