Passing a parameter - InfoPath Dev
in

InfoPath Dev

Passing a parameter

Last post 11-14-2007 12:50 AM by Helen.Trim. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 11-12-2007 08:23 AM

    • Helen.Trim
    • Not Ranked
      Female
    • Joined on 10-23-2007
    • Hampshire, England
    • Posts 3

    Passing a parameter

    I am new to InfoPath developing, so I hope that someone can help.  I have an InfoPath 2007 form that recieves data from a web service for a given patient.  I have a web application ( C#, Visual Studio 2005 ) that opens the InfoPath form and I want to pass it the patient number.  My code looks like this so far:

     

    Microsoft.Office.Interop.InfoPath.Application IPUri FormPathUri;        // URI of the blank InfoPath formXDocument Document;     // The form to open in InfoPath        IP = new Microsoft.Office.Interop.InfoPath.Application();

    Document = IP.XDocuments.NewFromSolution(FormPathUri.AbsoluteUri);

    // I need a line here

    Document.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/tns:DatabaseToXMLFile/tns:Pat_no").text = Pat_No;

     

    I need a line of code to specify the namespaces used in the selectSingleNode line.  What should it be?  I have tried lots of things without success, so I will be very grateful for your advice.

     

    Thanks,

    Helen 

     

  • 11-13-2007 08:18 AM In reply to

    I believe you just need the namespaces from the form you just opened. At least that is what I usually do is just copy the namespaces from the form into the code.

  • 11-14-2007 12:50 AM In reply to

    • Helen.Trim
    • Not Ranked
      Female
    • Joined on 10-23-2007
    • Hampshire, England
    • Posts 3

    Hello Clay

     

    Thanks for replying.  I have the namespaces from the form, I'm just not sure how to set them in the code.  I tried:

    Document.DOM.setProperty("SelectionNamespaces", "xmlns:dfs=\'http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\' xmlns:tns=\'http://tempuri.org/\'");

     

    But this gives an error: 'Microsoft.Office.Interop.InfoPath.Xml.IXMLDOMDocument' does not contain a definition for 'setProperty'

     

    I can't find the correct code anywhere.  Can you help, please?

     

    Regards

    Helen

     

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