Opening one InfoPath form from another in Code - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Opening one InfoPath form from another in Code

Last post 03-30-2011 09:44 PM by Patrick Halstead. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-29-2011 09:13 AM

    Opening one InfoPath form from another in Code

    Hi,

    I have a 2007 form which opens other 2007 forms from code.  I open the forms and submit them, to ensure that the OnFormOpen code gets run, and the data checked/updated on a regular basis.  Neither the starting form or the forms it opens are browser enabled.

    My starting form is published to SharePoint, and the forms it opens are in a different SharePoint Forms Library.  This has worked fine in the past, I have not changed the form, but it has stopped working from SharePoint.  When I am using the designed version on my PC and running in preview it works.  Both forms are running with Full Trust and have valid security certificates.

    The bit of code in question is...

    fileLocation = "http://......../eu-it/ARK/ARKDocuments/" & xmlfile & ".xml?util=openallforms"
    Try
    returnValue = Me.Application.XmlForms.Open(fileLocation, behavior)
    Try
    returnValue.Submit()
    Catch ex1 As Exception
    returnValue.Close()
    failedtext = failedtext &
    "| Failed to Submit " & node.SelectSingleNode("./QDname", NamespaceManager).Value
    End Try
    returnValue.Close()
    Catch ex As Exception
    failedtext = failedtext &
    "| Failed to Open" & node.SelectSingleNode("./QDname", NamespaceManager).Value
    End Try

    I keep getting the "Failed to Open" returned.

    Does anyone have any ideas why it works in preview and not in published mode ?  Or any ideas what could have stopped the published one from working ?

    Any help would be gratefully received.

    Thanks

    Catharine

    Filed under: , , ,
  • 03-29-2011 09:57 AM In reply to

    Re: Opening one InfoPath form from another in Code

    I have found the exception is

    System.Runtime.InteropServices.COMException (0x800430D8): InfoPath cannot open the following file: http://.../eu-it/ARK/ARKDocuments/79.xml?util=openallforms. The selected file is an update of a form on your computer. However, the update has been blocked because the author of the file cannot be verified. If this file is a legitimate update, use the Fill Out a Form dialog box to remove the original form from your computer, and then open this file. Form template name: ARKForm Form template ID: urn:schemas-microsoft-com:office:infopath:ARKForm:-myXSD-2008-10-20T11-19-34 Form template location: http://.../eu-it/ARK/ARKContentTypeLibrary/ARKForm.xsn at Microsoft.Office.Interop.InfoPath.SemiTrust.XDocumentsCollectionWrapper.Open(Object varURI, Int32 dwBehavior) at Microsoft.Office.InfoPath.Internal.XmlFormsHost.Open(String fileLocation, XmlFormOpenMode behavior) at OpenAllForms.FormCode.OpenAllForms_Clicked(Object sender, ClickedEventArgs e)79

    I have since cleared the Infopath cache of the (Run Infopath /cache clearall)

    And it is now working again.  I have not changed the certificates at all.  Any ideas what could have caused it ?

    Catharine

  • 03-30-2011 09:44 PM In reply to

    Re: Opening one InfoPath form from another in Code

    Hi Catharine,

    I've never seen that warning message before. My guess is that maybe you had a previously installed URN version of the form (MSI deployment) and that the form on the SharePoint site was deployed as a URN based solution and was since updated. That is indeed a corner case but it could produce something like what you saw.

    Best!

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