Populating an InfoPath form with data.

Posted in  |  | .  

In one of the prototypes I was working on I had to programmatically populate an InfoPath form with data.

After loading the required data and serializing it to the required schema I thought calling "thisXDocument.DOM.loadXML(strXmlData)" should do the job of populating the form with the data.

That call, however, triggers a "The DOM can't be loaded twice" error.

After a quick search in the SDK help I came up with the following solution (which merges two DOMs):

IXMLDOMDocument newDOM = thisXDocument.CreateDOM();
newDOM.loadXML(strXmlData);
thisXDocument.ImportDOM(newDOM);

About

Eran Kampf draws upon 8+ years of experience in software development and research. Eran served in the IDF's elite geospatial-intelligence as a senior software developer and is currently working at SAP as an R&D Engineer working on Duet which is jointly developed by SAP & Microsoft.
AddThis Feed Button Give Feedback

On this page...

Recent Comments

Tags

Statistics

Total Posts: 481
This Year: 61
This Month: 0
This Week: 0
Comments: 281

Google Ads