Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)
The SharePointListQueryConnection object represents a data connection created in InfoPath using the Data Connection Wizard that specifies all the information necessary for retrieving data from a SharePoint list or document library.
The SharePointListQueryConnection class provides properties that can be used to get the name of the data connection and the Uniform Resource Locator (URL) of the list or document library on the Windows SharePoint Services site from which the connection retrieves data.
The SharePointListQueryConnection object associated with the data connection is accessible using the DataConnections property of the XmlForm class to return the connection from the DataConnectionCollection of the form template.
The default Execute method, inherited from the DataConnection base class, performs a query or submit operation using the values that were declaratively defined in InfoPath form template design mode. Additionally, the SharePointListQueryConnection class provides the SharepointListQueryConnection.Execute method, which allows you to specify a different location to insert the data that is returned.
The SharePointListQueryConnection class corresponds to the SharePointListAdapterObject interface of the Microsoft Office InfoPath 2003 object model.
In the following example, a reference to the SharePointListQueryConnection object that represents the connection named "Contacts", which connects to a list of contact information on SharePoint, is set by passing the name to the Item property of the DataConnectionCollection class, and then casting the returned object to the SharePointListQueryConnection type.
SharePointListQueryConnection spConnection = (SharePointListQueryConnection)this.DataConnections["Contacts"];
Dim spConnection As SharePointListQueryConnection = _ DirectCast(Me.DataConnections("Contacts"), _ SharePointListQueryConnection)
After the reference has been set, you can use the properties or methods of the SharePointListQueryConnection object. The following example sets a string variable to the value returned by the Name property inherited from the DataConnection base class.