Creating a new form from command-line - InfoPath Dev
in

InfoPath Dev

Creating a new form from command-line

Last post 03-09-2005 01:09 PM by Patrick Halstead. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-03-2005 05:00 AM

    Creating a new form from command-line

    This issue may be related to the IDE or to the fact that I am new to both c# and Infopath sdk. But I was wondering if you could help anyway.

    Basically we have a console based tool that will parse a Text file for values that we will use to populate the form.

    Also from within the Infopath project, currently we can populate the form and we can then just invoke infopath at the command-line.

    However I am looking for a way to invoke form creation directly from our command-line tool, e.g. by calling Newfromsolution. However it appears that I am only allowed to call this function from within an Infopath project class. I'm also not allowed to call NewFromSolution from within the "OnLoad" handler so where would I call it from?

    thanks in advance
    Tadhg
  • 03-09-2005 12:05 AM In reply to

    Re: Creating a new form from command-line

    Hi Tadhg,
    Welcome to the board! Why not just create XML from your command line tool and add the InfoPath Processing Instruction (PI) to the form? Then, you can execute the form and it will load InfoPath and display it. NewFromSolution is detailed in the SDK. Do you have the SDK? If not, it is a total must have.
    Hope this helps!
    Patrick
    Patrick Halstead
    Project Manager at Qdabra
  • 03-09-2005 09:18 AM In reply to

    Re: Creating a new form from command-line

    Hi Patrick

    Thanks for that.
    So can you clarify if you mean that I should create an XML document from the command line code? That is should I create the full structure of the Form (including all fields) within this XML?
    Are you suggesting I use a href to point the XSN template, in the PI, instead of the name attribute?

    Regarding processing instructions. I assume I will need to include all Processing instructions in the header i.e.:
    The application PI: <?mso-application progid="InfoPath.Document"?>
    The file attachment PI (since the forms will include attachemtns) <?mso-infoPath-file-attachment-present?>

    as well as the msolution PI:
    <?mso-infoPathSolution solutionVersion="1.0.0.282" productVersion="11.0.6357" PIVersion="1.0.0.0" ?>

    Finally I call the NewFromSolution method to launch the form. But do you mean that I call this from within my command line code? If so do I still use the XDocuments version of this method or the ExternalApplication version.

    thanks for you help
    Tadhg

  • 03-09-2005 01:09 PM In reply to

    Re: Creating a new form from command-line

    Hi again,

    You can use a URN-based form to dispense with the need for a hardcoded href. Then it will work regardless of where you run it (so long as the InfoPath URN-based form is registered - use regform for that).

    Yes, I was saying that just use the command tool or whatever to create the XML that InfoPath loads, or you could create it and use Import. Either way, if there is a problem in the XML you will have problems loading the form, so this is a somewhat brittle approach.

    Yes, you will need the mso-application as well as the mso-infoPathSolution PIs.

    No need to call NewFromSolution. Just run the form.

    Hope this helps.
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.