Error with form code when there are no form codes? - InfoPath Dev
in

InfoPath Dev

Error with form code when there are no form codes?

Last post 08-18-2010 09:46 PM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-18-2010 09:01 PM

    Error with form code when there are no form codes?

    Hi,

     My form crashed with the following error message when I try to open the form from DBXL's DAT page:

    System.Runtime.InteropServices.COMException
    InfoPath cannot create a new, blank form.
    InfoPath cannot open the form. To fix this problem, contact your system administrator.

    Form template: HTTP://Mywebserver/QdabraWebService/Forms/ID/201/template.xsn
    InfoPath cannot open the selected form because of an error in the form's code.
    One or more required components of InfoPath or the form template cannot run because of a security restriction.
    Contact your system administrator or run Setup again to confirm that .NET Programmability Support is installed on your computer.
    Request for the permission of type 'Microsoft.Office.InfoPath.InfoPathPermission, Microsoft.Office.InfoPath.Client.Internal.Host, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed.

       at Microsoft.Office.Interop.InfoPath.SemiTrust.XDocumentsCollectionWrapper.NewFromSolution(Object varURI)
       at AdminTool.Configuration.OpenTemplate(String templateUrl)
       at AdminTool.Configuration.btnNewDocument_OnClick(DocActionEvent e)
       at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

    The form used to have form codes but ever since it crashed, I've removed (commented) them but still the form crashes. Do I need a security cert or something like it for my form?

     Does anyone know how I can resolve my error message? Thanks!

  • 08-18-2010 09:10 PM In reply to

    Re: Error with form code when there are no form codes?

    This error occurs when you try to open a form using the Open link in DAT and the form has IP 2007 object model code.  Even if the code is commented out, there is still code in the form.

    Instead of the Open link, please try the download icon (with the green arrow) on the General tab in DAT.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-18-2010 09:19 PM In reply to

    Re: Error with form code when there are no form codes?

    But I've always been on IP 2007 (and no problems) and this is the first time I see this error and it was right before I added some code. Yes, using the download option works... I am very depressed because I spent 2 days trying to solve this...

    But thankfully I finally gave up and posted my error here. Thanks alot Jimmy for your fast reply!

    Does this mean my code is ok? If yes, I will load back all the code and continue with my form design. In any case, through this episode, I realized we can use certificates. When will a form need full trust and certificates?

    Thanks!

  • 08-18-2010 09:46 PM In reply to

    Re: Error with form code when there are no form codes?

    This error will happen any time there is any IP 2007 OM code in your form.  Even if you haven't added any of your own code to FormCode.cs, if the form is set up to use IP 2007 code, you will experience this problem with the Open link in DAT.  It's caused by an incompatibility between the IP 2007 and 2003 OMs (DAT uses the 2003 OM).

    You can go ahead and add your code back to the form.  This error isn't caused by any problem in your code.

    Certificates and Full Trust would generally be used when your form accesses local resources (such as the local file system) or makes internet requests from code to locations outside your local intranet zone.  We tend to recommend against using full trust forms whenever possible, as it makes deploying them more complicated.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.