How to reserve the original filename during the submisson in InfoPath 2003 - InfoPath Dev
in

InfoPath Dev

How to reserve the original filename during the submisson in InfoPath 2003

Last post 03-13-2009 01:28 AM by blhchung. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-10-2009 02:23 AM

    How to reserve the original filename during the submisson in InfoPath 2003

    Hi guys,

    I am new to InfoPath. I am using InfoPath 2003 and doing Form submit to Sharepoint server.

    Can I bypass the filename naming in "Data connections"  (somehow it is mandatory and only allow you to get values from the schema) and using the original filename as the filename during submission via programming?

     Any idea about this? Thank you so much!

     

    Have a nice day,

    Brian.

     

     

     

     

     

    Filed under:
  • 03-11-2009 01:16 AM In reply to

    Re: How to reserve the original filename during the submisson in InfoPath 2003

     Resolve! Thanks!

  • 03-12-2009 04:02 AM In reply to

    • Ajrob
    • Not Ranked
    • Joined on 03-12-2009
    • Spain
    • Posts 2

    Re: How to reserve the original filename during the submisson in InfoPath 2003

     I have a similar issue, how did you resolve it?

    Thank you.

  • 03-13-2009 01:28 AM In reply to

    Re: How to reserve the original filename during the submisson in InfoPath 2003

     For my case, I use the jscript to resolve the problem. See the coding below

    function XDocument::OnSubmitRequest(eventObj)
    {
         //The acutal filepath
        //XDocument.UI.Alert("Location " + XDocument.URI);
     
       var filepath, filename;  
       filepath =  XDocument.URI
       //Get only the filename from Windows local drive
       filename = filepath.substring(filepath.lastIndexOf("\\") + 1);
             
            
      var strUrl = "YOUR SHAREPOINT ADDRESS"
      var folderName = "SPECIFIC FOLDER"

        var xnFolderName = folderName;
        var xnLocation = strUrl;
       
       
        //Get a reference to the submit data connection
        var fc = XDocument.DataAdapters["Submit to SharePoint"];
       
        //Modify the Submit connection URL we want to submit to by concatenating the
        //xnLocation and xnFolderName values
        fc.FolderURL = xnLocation + "/" + xnFolderName;
        //Use Original filename rather than DataConnection filename
        fc.FileName = filename;
       
       
        //Execute the submit connection
       
        try
        {
            fc.Submit();
            eventObj.ReturnStatus = true;
        }
        catch(ex)
        {
            thisXDocument.UI.Alert("The following error has occured: " + ex.DetailedErrorMessage);
            eventObj.ReturnStatus = false;
        }
    }

     

    Thanks

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