Edit

Share via


SharepointListQueryConnection Class

Definition

Caution

The SharePointListQueryConnection class has been deprecated. Use SharePointListRWQueryConnection instead.

Represents a data connection for retrieving data from a SharePoint list or document library.

public ref class SharepointListQueryConnection abstract : Microsoft::Office::InfoPath::DataConnection
[System.Obsolete("The SharePointListQueryConnection class has been deprecated. Use SharePointListRWQueryConnection instead.")]
public abstract class SharepointListQueryConnection : Microsoft.Office.InfoPath.DataConnection
type SharepointListQueryConnection = class
    inherit DataConnection
Public MustInherit Class SharepointListQueryConnection
Inherits DataConnection
Inheritance
SharepointListQueryConnection
Attributes

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[String] 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

Remarks

Important: The SharepointListQueryConnection class and its members have been deprecated in Microsoft InfoPath. 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 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 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 Execute(XPathNavigator) 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.

Constructors

SharepointListQueryConnection()

Properties

Name

Gets the name of the data connection.

(Inherited from DataConnection)
QueryThisFormOnly

Gets whether the query operation will apply only to the current form.

SiteUrl

Gets a System.Uri object that represents the Uniform Resource Locator (URL) of the Windows SharePoint Services site associated with the SharepointListQueryConnection object.

Methods

Execute()

Depending on which ConnectionTypeConnection class it is called from, executes a submit or query operation on the data connection using the declaratively defined values for the submitted data, query parameters, or data to retrieve.

(Inherited from DataConnection)
Execute(XPathNavigator)

Overrides the default Execute() method to allow specifying a different location to insert the data that is returned.

Applies to