FileQueryConnection class

Office 2013 and later

Represents a connection for retrieving data from an XML file.


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

public abstract class FileQueryConnection : DataConnection

The FileQueryConnection class represents a data connection created in InfoPath using the Data Connection Wizard that specifies all the information necessary for retrieving data from an XML file that is used as a secondary (external) data source.

The FileQueryConnection object is accessible using the DataConnections property of the XmlForm class to return the connection from the DataConnectionCollection of the form template.

The FileQueryConnection object can also be accessed from DataSourceCollection of the form template using the DataSources property of the XmlForm, and the QueryConnection property of the DataSource class as shown in the following line of code.

FileQueryConnection myDataSource = 

The FileQueryConnection class provides the FileLocation property, which can be used get or set the Uniform Resource Locator (URL) or universal naming convention (UNC) path of the XML file that is being used an external data source.

In addition to the default Execute method inherited from the DataConnection base class that performs a query operation using the values that were declaratively defined in InfoPath form template design mode, the FileQueryConnection class also provides the FileQueryConnection.Execute method, which allows you to specify a different XML node in which to insert the data returned from the external XML file.

The FileQueryConnection class corresponds to the XMLFileAdapterObject class of the Microsoft Office InfoPath 2003 object model.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.