Using 1 form library to support many templates! - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Using 1 form library to support many templates!

Last post 05-02-2006 02:14 AM by Agni Jonnalagadda. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 01-03-2006 10:57 AM

    Using 1 form library to support many templates!

    All,

    I saw this interesting article. Check it out.

    Using one form library to support multiple InfoPath templates -http://www.msd2d.com/Content/Tip_viewitem_03NoAuth.aspx?id=508c8437-ee7f-4ba0-ac43-183308e3be0b§ion=Sharepoint
    Jason
    http://www.k2distillery.com/
  • 01-17-2006 07:04 PM In reply to

    Re: Using 1 form library to support many templates!

    Thanks for the link, that was a very interesting read!

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-19-2006 08:59 AM In reply to

    • Sumeet
    • Not Ranked
    • Joined on 08-25-2005
    • USA
    • Posts 12

    Re: Using 1 form library to support many templates!

    Hi guys,

    I am facing the problem that each time I modify the code and re-Publish the infopath form to the same forms library in sharepoint thus over-writing the previous template, then the previously created forms[based on the previously template] don't open up anymore. Is there a setting that I have to do or could you please suggest what should be done.

    Thanks

    Sumeet
  • 01-19-2006 10:34 AM In reply to

    Re: Using 1 form library to support many templates!

    Try relinking your forms.

    1) On the Document Library page that you have the form stored to click "Modify Settings and Columns".
    2) Click Relink forms to this form library
    3) Check all checkboxes
    4) click Relink Forms

    ---------------
    Matt Faus
    InfoPath Dev Texas
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 01-20-2006 02:06 PM In reply to

    • Sumeet
    • Not Ranked
    • Joined on 08-25-2005
    • USA
    • Posts 12

    Re: Using 1 form library to support many templates!

    Hi Matt,

    Thanks for your help but it didn't work. When I click the Relink forms to this form library then there are no forms present in the list to be relinked.

    Since I had the forms created from the previous XSN and the new one, I downloaded them to my box and viewed their XML content and found that the forms created using the old XSN were missing an XML element so it kept bombing out everytime.

    This is a major concern since as I keep modifying the code for the XSN, I am sure to add more fields to the datasource section of the form and giving them default values(by going under Tools -> Form Options -> Edit Default Values) then all the previously created forms will stop working since they will be missing a particular XML element in their schemas.

    Is there a way that I can automatically update the XML elements in previously created forms so that I don't have to do it manually each time.

    Thanks

    Sumeet
  • 01-23-2006 01:25 AM In reply to

    Re: Using 1 form library to support many templates!

    Hi Sumeet,
    If you modify the schema it will be a problem. You can work around this by always adding optional elements. If the elements are changed, deleted, or not optional, automatic upgrade won't work.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 05-01-2006 09:47 PM In reply to

    Re: Using 1 form library to support many templates!

    Hi people,

    Is there a way to automatically relink form template from the infopath form?

    I mean if I have 2 templates:
    - template A
    - template B

    and I've created a form using template A.
    And later on, I publish template B to the same sharepoint folder.

    When the form is loaded up, can I specify somewhere in the code (or using any existing infopath built in function) to relink the form automatically to use template B?
    (rather than going to "modify settings and column, and click on "relink forms" externally).

    thank u :)
  • 05-01-2006 10:13 PM In reply to

    Re: Using 1 form library to support many templates!

    Yes you can relink the form from the code.
    Here is how you can do it,
    //Get the root node
    IXMLDOMNode rootNode = getNode("ROOTNODEXPATH");
    //Get the new PI which points to the new template
    string newPI = "PIOFNEWTEMPLATE";
    //Create a new DOM
    IXMLDOMDocument newXMLDOM = thisXDocument.CreateDOM();
    //Load the XML
    newXMLDOM.loadXML(newPI + rootNode.xml);
    //Get reference to the Sharepoint Submit connection
    DAVAdapter sharePointSubmitConnection = (DAVAdapter)thisXDocument.DataAdapters["SHAREPOINTSUBMITCONNECTIONNAME"];
    //Submit new DOM which point to the new template to the Sharepoint
    sharePointSubmitConnection.SubmitData(newXMLDOM);
  • 05-01-2006 11:09 PM In reply to

    Re: Using 1 form library to support many templates!

    hi Agni, thanks for the speedy reply :)

    A couple of questions regarding the solution:

    quote:
    //Get the root node
    IXMLDOMNode rootNode = getNode("ROOTNODEXPATH");


    In JScript equivalent, would this be something like:
    var rootNode = XDocument.DOM.selectSingleNode("/my:myFields");
    ?

    quote:
    //Get the new PI which points to the new template
    string newPI = "PIOFNEWTEMPLATE";


    I'm sorry if this is too obvious, but what's PI?

    quote:

    //Get reference to the Sharepoint Submit connection
    DAVAdapter sharePointSubmitConnection = (DAVAdapter)thisXDocument.DataAdapters["SHAREPOINTSUBMITCONNECTIONNAME"];
    //Submit new DOM which point to the new template to the Sharepoint
    sharePointSubmitConnection.SubmitData(newXMLDOM);


    Does this mean that in order for the form to use the new template, it needs to be submitted first to the sharepoint?
    So if I put the above code in the event OnLoad, would the form be able to use the new template straight away, Agni?


    thanks in advanced :)
  • 05-02-2006 02:14 AM In reply to

    Re: Using 1 form library to support many templates!

    Question 1: Yes

    Question 2: PI - Processing Instruction :- PI is used by InfoPath to point your XML to the correct template. If you open one of your xml files, the text above your root node is called PI.

    PI looks similar to this
    <?xml version="1.0" encoding="UTF-8"?>
    <?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:ProjectName:-myXSD-2005-07-28T22-51-00" href="http://servername/sites/libraryname/forms/template.xsn" solutionVersion="1.0.0.179" productVersion="11.0.6357" PIVersion="1.0.0.0" ?>
    <?mso-application progid="InfoPath.Document"?>


    Question 3: After submitting the form you need to reopen the form to work with the new template.
Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.