Record a form to two differents destinations - InfoPath Dev
in

InfoPath Dev

Record a form to two differents destinations

Last post 10-31-2007 10:00 AM by Greg Collins. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 10-29-2007 04:31 AM

    Record a form to two differents destinations

    Hello everybody.


    I am using Infopath 2003 and have the following issue: I'would like to create a form which will be record into two differents containers. That when the user will click on a submit button. The destinations are:

    1. A SharePoint directory

     2. A network directory.

     
    The first option is not problem, as Infopath can manage the connection toward a Infopath Library. The problem I meet is for recording into the network directory. I use VBS. Here is the code:

     

    Code\

     XDocument.DOM.setProperty "SelectionNamespaces", "xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-09-13T12:12:25"""

      Path = "E:\Test\"

      Nom = "FichierTest_241207"

     

    Sub CTRL50_5_OnClick(eventObj) 

              XDocument.UI.Alert("This is a test.")

             If(XDocument.IsDirty)Then

                    XDocument.UI.Alert("Doc has been modified")

            Else

                    XDocument.UI.Alert("Doc has been changd")

            End If

    End Sub

    Sub XDocument_OnSaveRequest(eventObj) 

                 eventObj.IsCancelled = eventObj.PerformSaveOperation(XDocument.SaveAs(Path & Nom + ".xml"))

                eventObj.ReturnStatus = True
    End Sub

     

    /Code

     

    The message I get, when I modified the form and accepted to record is the following:

    "InfoPath cannot record the form under the following name: E\Test\FithierTest_241207.xml." "Contexte de l'appel de modèle objet non valide"

     

    (I don't know how to translate the laste sentence) 

     

    Have you got any Idea of what I can do?

     

    Best regard
     

  • 10-31-2007 10:00 AM In reply to

    Re: Record a form to two differents destinations

    The last error message is something like "the context of the object model call is invalid".

    Anyway, the issue is here: eventObj.PerformSaveOperation(XDocument.SaveAs(Path & Nom + ".xml"))

    You cannot have the SaveAs() method inside the PerformSaveOperation() method... this is invalid. You must use one or the other.

    SaveAs() requires your form to be set to Full Trust... but is the method you need in order to save to a specific location.

    I don't recall for certain whether you need to use "E:\\Test\\" or if "E:\Test\", as you have it now, will work fine.

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