FileSubmitConnection.Filename Property

Gets an XPathTypedValue that evaluates to the file name that the current form will be given when the form is submitted by the FileSubmitConnection object.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

Syntax

'Declaration
'Usage

Property Value

An XPathTypedValue that evaluates to the file name that the form will be given when it is submitted.

Remarks

The value of the Filename property of the FileSubmitConnection class is returned as an XPathTypedValue object, which can be set by specifying a literal string using the SetStringValue method of the XPathTypedValue class, or by specifying an XPath expression using the XPath property of the XPathTypedValue class. For more information and code samples, see the XPathTypedValue Class topic.

The ".xml" file name extension will be appended to the string if it is not already included. If the Filename property is null, the form is given the name "Form.xml" when it is submitted.

If an XPath expression, such as concat("Status Report -", field1), has been specified in the File name box of the Data Connection Wizard when the data connection was defined, you can return that expression by using the XPath property of the XPathTypedValue class, as shown in the following example.

   FileSubmitConnection submitConnection = 
      (FileSubmitConnection)(DataConnections["SharePoint Library"]);
   MessageBox.Show (submitConnection.Filename.XPath.ToString());
   Dim submitConnection As FileSubmitConnection = 
      DirectCast(DataConnections["SharePoint Library"], _
      FileSubmitConnection)
   MessageBox.Show (submitConnection.Filename.XPath.ToString())

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

This type or member can be accessed from code running in forms opened in Microsoft Office InfoPath 2007 or in a Web browser.

Example

The following example uses the Filename property of the FileSubmitConnection object to display the file name that will be used when submitting the form to the data connection.

   FileSubmitConnection submitConnection = 
      (FileSubmitConnection)(DataConnections["SharePoint Library"]);
   MessageBox.Show (submitConnection.Filename.ToString());
   Dim submitConnection As FileSubmitConnection = 
      DirectCast(DataConnections["SharePoint Library"], _
      FileSubmitConnection)
   MessageBox.Show (submitConnection.Filename.ToString())

See Also

Reference

FileSubmitConnection Class
FileSubmitConnection Members
Microsoft.Office.InfoPath Namespace