SharepointListQueryConnection Class (Microsoft.Office.InfoPath)
Represents a connection for retrieving data from a SharePoint list or document library.
Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)
Syntax
'Declaration
Public MustInherit Class SharepointListQueryConnection
Inherits DataConnection
'Usage
Dim instance As SharepointListQueryConnection
public abstract class SharepointListQueryConnection : DataConnection
Remarks
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.
Example
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.
[C#]
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.
string spName = spConnection.Name;
Dim spName As String = spConnection.Name
Inheritance Hierarchy
System.Object
Microsoft.Office.InfoPath.DataConnection
Microsoft.Office.InfoPath.SharepointListQueryConnection
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
SharepointListQueryConnection Members
Microsoft.Office.InfoPath Namespace