Click here to Skip to main content
13,254,077 members (60,606 online)
Click here to Skip to main content
Add your own
alternative version


8 bookmarked
Posted 8 Jun 2009

Submitting an InfoPath Form to SharePoint with a Unique Filename

, 8 Jun 2009
Rate this:
Please Sign up or sign in to vote.
How to submit an InfoPath form to SharePoint without creating a different filename each time a form is resubmitted.


InfoPath can be configured to allow users to submit an InfoPath form to a SharePoint library automatically with a unique name and without creating a different file name each time a form is resubmitted.


The following solution assumes that a SharePoint (MOSS) 2007 or SharePoint Services 3.0 library and an InfoPath 2007 template have been created.

A hidden field is added to the form template. Each form is assigned a unique filename by concatenating field(s) in the form with the now() function. Rules are added to the Submit options to determine whether or not a filename exists, so each time a form is resubmitted, it is not saved under a different filename.

Note: An InfoPath form can be added to SharePoint by assigning a unique filename directly in the Data Connection without using a hidden field or rules, but the use of the now() function will cause the form to be saved under a different filename each time it is resubmitted.


  • Step 1 – Create a Hidden Field
  • Step 2 -  Add a Submit data connection
  • Step 3 - Add Custom Rules to Submit action

Step 1 – Create a Hidden Field

A hidden field is a field that exists in the data source of the form but is not visible to the user.

The easiest way to create a hidden field is to drag-and-drop a text box control onto the form template’s view. Rename the text box to ‘filename’ and click OK. Then select the filename text box and hit delete to remove the field from the view.


Step 2 – Add a Submit Data Connection

Go to Tools, Data Connections and click Add. Create a new Connection to Submit data to a SharePoint document library:



Enter the document library, and click the fx button and Insert the field ‘fileName’ in order to give the form submitted the name stored under ‘fileName’. Select ‘Allow overwrite if file exists’.


Give the data connection a name:


Step 3 – Add Custom Rules to Submit Action

Go to Tools, Submit Options, and click on Rules.


Add two rules as follows:

  • Rule 1 (fileNameBlank):


  • Set condition: filename is blank:


  • Set Action 1: Set field’s value filename = concat (Myfield, now()):

    Use field on the form i.e., contactName, followed by the function now() to add the date & time and give the form a unique name.


  • Set Action 2: Submit using a data connection (the one created in Step 2):


  • Rule 2 (fileNamenotBlank):


  • Set Condition: filename is not blank:


  • Set Action: Submit using a data connection (the one created in Step 2):


You should now have the following 2 rules setup for Submitting Forms:



  • 8th June, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Catherine Wright
United States United States
Sr. Technical Project Manager

You may also be interested in...

Comments and Discussions

Questionfrom where you get the ContactName option Pin
Somnath8326-Jun-13 20:28
memberSomnath8326-Jun-13 20:28 
QuestionSubmit works but still asks me to save Pin
Ivan de Sousa28-Sep-12 6:18
memberIvan de Sousa28-Sep-12 6:18 
QuestionThanks Pin
Amy Greene9-Dec-09 13:50
memberAmy Greene9-Dec-09 13:50 
AnswerRe: Thanks Pin
Catherine Wright10-Dec-09 12:56
memberCatherine Wright10-Dec-09 12:56 
I have not experienced this issue. Is this happening with just one rich text field? Have you tried creating other rich text fields? If it's just one, you could have some corrupted XML in your form and you may want to try completely deleting and recreating the rich text field that is causing the issue. If you still need help, I would suggest posting a message on the Microsoft InfoPath forum. It's a very active forum.

Catherine Wright, MBA,MCSD.NET,PMP,CSM

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171114.1 | Last Updated 8 Jun 2009
Article Copyright 2009 by Catherine Wright
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid