How can I name the Form when I Submit

P

Paul

I have a form that submits to a SharePoint Library, when the user clicks
submit, the form is always "form.xml"

How can I name the form prior to submitting (in code)

P
 
D

Don Reamey [MSFT]

You can use the function (FX) to change the name of the form.

In the submit options you should be able touse the File Name field to create any name you like. The example used is Concat("Status Report - ", now()).

This will give you a file named Status Report-16:40pm.xml for example.

--
Don Reamey
Microsoft
Software Development Engineer
InfoPath Forms Server
http://blogs.officezealot.com/dreamey
 
S

Santhosh (GGK Tech)

Hi,

You can name the form by using the following code.

public void SubmitToSharePoint(string submitAdapterName, string
sharePointFolderPath, string fileName)
{

DAVAdapter sharePoint =
(DAVAdapter)thisXDocument.DataAdapters[submitAdapterName];
sharePoint.FileName = fileName;
sharePoint.FolderURL = sharePointFolderPath;
sharePoint.Submit();

}


In the above code 'submitAdapterName' is SharePoint data connection name,
'sharePointFolderPath' is path to SharePoint form library, 'fileName' is name
to the file you are submitting.
Dont forget to add ".xml" to the file name while calling the function.
e.g:
SubmitToSharePoint("Submit Connection",
"http://<server>/<Site>/<FormLibrary>", DateTime.Now.ToString() + ".xml")
 
Top