SharepointListAdapter Object

Microsoft Office InfoPath

Show All Show All

SharepointListAdapter Object

Represents a connection to a SharePoint list or document library. The SharePointListAdapter object represents the Office InfoPath 2003 data adapter for retrieving data from a SharePoint list or document library.

Remarks

Note  This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.

Using the SharepointListAdapter Object

For a secondary data source, the SharePointListAdapter object is accessible through the QueryAdapter property of a data adapter object. Data adapter objects are accessible through the DataAdapters property of the XDocument object.

The SharepointListAdapter object contains the following properties:

Property Description
Name Returns the name of the SharepointListAdapter object.
QueryAllowed A read-only property of type Boolean that corresponds to the queryAllowed attribute in the form definition file (.xsf). Always returns True for the SharepointListAdapter object.
SiteUrl A read-only property returning the Uniform Resource Locator (URL) of the SharePoint site that this adapter can query from.
SubmitAllowed Corresponds to the submitAllowed attribute in the form definition file (.xsf). Always returns False for the SharepointListAdapter object.

The SharepointListAdapter object contains the following methods:

Method Description
Query Reads data from the SharepointListAdapter object.
Submit Because the SharepointListAdapter object is available for receiving data only, this method will always generate a run-time error when it is called on that object.

Example

In the following example, a reference to the SharePointListAdapter object is accessed through the QueryAdapter property of a data adapter object by passing the name of the data adapter object to the Item property of the DataAdapters collection:

    var objSPLAdapter;
objSPLAdapter = XDocument.DataAdapters("Announcements").QueryAdapter;
  

After the reference has been set, you can use the methods of the SharePointListAdapter object as shown in the following example, which requeries the SharePoint list or library to update the DOM property of the data adapter object:

    objSPLAdapter.Query();