SharePoint List with InfoPath C# - InfoPath Dev
in

InfoPath Dev

SharePoint List with InfoPath C#

Last post 05-28-2008 06:05 PM by phamj. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 05-28-2008 06:05 PM

    • phamj
    • Top 500 Contributor
      Female
    • Joined on 05-22-2008
    • Australia
    • Posts 26

    SharePoint List with InfoPath C#

    I am trying to do something similar to this click here - utilizing secondary datasource in InfoPath, however in C#.  I found another article that connect the secondary data source to a webservice - quite helpful but I still couldn't get around to making it work properly. 

    // Get a reference to the secondardy datasource

    IXMLDOMDocument2 spDOM = (IXMLDOMDocument2)thisXDocument.DataObjects["Contact Details"].DOM;

    // Set the SelectionNamspaces to find the correct fields

    spDOM.setProperty("SelectionNamespaces", "xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\"");

    // Get the selected contact text

    string selectedContact = thisXDocument.DOM.selectSingleNode("/my:document/my:metadata/my:doc_contact_name").text;

    // Get the selected node

    spDOM.selectSingleNode("/dfs:myFields/dfs:dataFields/dfs:Contact_Details[@Name='" + selectedContact + "']");

    // Set the texbox texts

    thisXDocument.DOM.selectSingleNode("/my:document/my:metadata/my:doc_contact_role").text = spDOM.documentElement.attributes.getNamedItem("Title").text;

      Just wondering if anyone could point out what I'm doing wrong.  The error: Object reference not set to an instance of an object

    Thanks in advance.

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.