SharepointListQueryConnection Class
NOTE: This API is now obsolete.
Represents a data connection for retrieving data from a SharePoint list or document library.
Inheritance Hierarchy
System.Object
Microsoft.Office.InfoPath.DataConnection
Microsoft.Office.InfoPath.SharepointListQueryConnection
Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)
Syntax
'Declaration
<ObsoleteAttribute("The SharePointListQueryConnection class has been deprecated. Use SharePointListRWQueryConnection instead.")> _
Public MustInherit Class SharepointListQueryConnection _
Inherits DataConnection
'Usage
Dim instance As SharepointListQueryConnection
[ObsoleteAttribute("The SharePointListQueryConnection class has been deprecated. Use SharePointListRWQueryConnection instead.")]
public abstract class SharepointListQueryConnection : DataConnection
Remarks
Important
The SharepointListQueryConnection class and its members have been deprecated in Microsoft InfoPath 2010. Code written with the members of this class is compatible only with a data connection to a SharePoint document library created in InfoPath 2003 or InfoPath 2007, with a data connection in a new form template created in InfoPath 2010 with one of the InfoPath 2007 Form Templates, or with a data connection converted with the Convert to Previous Version button in the Data Connections dialog box. To write code that works with a data connection to a SharePoint document library created in an InfoPath 2010 form template, use the members of the SharePointListRWQueryConnection class. Additionally, if you convert a data connection to a SharePoint document library with the Convert to Current Version button in the Data Connections dialog box, you must rewrite any code written with the members of the SharepointListQueryConnection class to use the members of the SharePointListRWQueryConnection class instead.
The SharePointListQueryConnection object represents a secondary 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.
Examples
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
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.