Host Infopath Form using Form Control-Error at NewFromFormTemplate(infopath) - InfoPath Dev
in

InfoPath Dev

Host Infopath Form using Form Control-Error at NewFromFormTemplate(infopath)

Last post 07-09-2007 08:52 PM by nseresha. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-09-2007 01:52 AM

    Host Infopath Form using Form Control-Error at NewFromFormTemplate(infopath)

    I feel my issue needs a new thread relating to hosting Infopath on windows forms using FormControl. Please let me know incase any active/replied thread relating to the topic.

    Scenario: I have a scenario where I need to show an infopath form in a new window on a button click. I could able to view it when no sql server connection is included.

    I made the form under "Trusted site" and linked to a "Certificate" following the article http://thorprojects.com/blog/archive/2007/06/30/670.aspx 

    Now if I run the application, The following error is shown at NewFromFormTemplate

    formControl1.NewFromFormTemplate(myInfopathForm);

    formControl1.SetSubmitToHostEventHandler(this);

     InfoPath cannot create a new, blank form.
    InfoPath cannot open the form. To fix this problem, contact your system administrator.
    
    Form template: D:\testInfopath5.xsn
    InfoPath cannot load this form. Either the signature is corrupted, or the certificate used to sign this form is expired or revoked. Contact the author of the form.

    formControl1.SetSubmitToHostEventHandler(this);

     InfoPath cannot create a new, blank form.
    InfoPath cannot open the form. To fix this problem, contact your system administrator.
    
    Form template: D:\testInfopath5.xsn
    InfoPath cannot load this form. Either the signature is corrupted, or the certificate used to sign this form is expired or revoked. Contact the author of the form.

    Please let me know way(s) to troubleshoot it.

     I used Microsoft.Office.Interop.InfoPath.ISubmitToHostEventHandler interface to access the methods.

    Thanks in advance

  • 07-09-2007 01:11 PM In reply to

    Re: Host Infopath Form using Form Control-Error at NewFromFormTemplate(infopath)

    The first thing I would try is to get the code working outside hosting to see if the call is correct. That would narrow down the issue to a hosting issue or some other certificate/InfoPath issue. Could you try that and let us know how that goes?

    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-09-2007 08:52 PM In reply to

    Re: Host Infopath Form using Form Control-Error at NewFromFormTemplate(infopath)

    Thanks for your reply.

    I created a new certifcate using Create Certificate Wizard of 'Security and Trust' in 'Form Options' of Infopath Form. It did work. Now I can see my Infopath form.

    My next task for infopath form was to include some controls, get them connected to data from SQL Express and update certain Master-child tables in the database on button click. I didnot include connection code but included namespaces (System.Data.SQLClient)

    When I tried to do the same, I got the following exception...

    InfoPath cannot open the selected form because of an error in the form's code.

    The Microsoft .NET Framework 1.1 is not installed on your computer or the InfoPath primary interop assembly (PIA) is not registered. Use Add or Remove Programs in Control Panel to make sure that Microsoft .NET Framework 1.1 is installed or install it using Windows Update, then run Setup again to confirm that .NET Programmability Support is installed, or contact your system administrator.

    That assembly does not allow partially trusted callers.

    I followed https://msdn2.microsoft.com/en-us/library/aa943009(VS.80).aspx  and done the following changes..

    1. checked to refer all the PIA's

    2. made "Run all from my computer"  in control panel->add/remove programs->Microsoft office 2007->change->.Net programmability support->Run all from my computer

    3. Re-run .NET 1.1 software as I am using .Net 3.0.

    Finally I got my infopath form integrated in new window of Smart Client Software Factory application. I am now stuck with the following issue that I couldnot trace as where to refer.

    I am trying to open a simple infopath form. get it fully trusted with certificate and write code in Visual Studio using 'Programming'. --- ERROR here

    Please do let me know how can I troubleshoot it.

    Infopath cannot add Event Handler.Infopath has encountered an error. The Operation failed.

    Thanks in advance..

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