DataConnection.Name property

Office 2013 and later

Gets the name of the data connection.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

public abstract string Name { get; }

Property value

Type: System.String
The name of the data connection as specified in the Data Connection Wizard in InfoPath design mode.

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 InfoPath Filler or in a Web browser.

In the following example, the Name property is used to display the name of each DataConnection object in the DataConnectionCollection object of the form template.

foreach (DataConnection connect in this.DataConnections)
{
   MessageBox.Show(connect.Name);
}
Show: