Edit

Share via


_XDocument4.DataAdapters Property

Definition

Gets a reference to the DataAdaptersCollection collection that is associated with a Microsoft InfoPath form.

public:
 property Microsoft::Office::Interop::InfoPath::SemiTrust::DataAdaptersCollection ^ DataAdapters { Microsoft::Office::Interop::InfoPath::SemiTrust::DataAdaptersCollection ^ get(); };
public Microsoft.Office.Interop.InfoPath.SemiTrust.DataAdaptersCollection DataAdapters { get; }
member this.DataAdapters : Microsoft.Office.Interop.InfoPath.SemiTrust.DataAdaptersCollection
Public ReadOnly Property DataAdapters As DataAdaptersCollection

Property Value

Implements

Examples

In the following example, the DataAdapters property of the XDocument object is used to set a reference to a data connection to a SharePoint list called "Contacts".

SharepointListAdapterObject myContacts = 
   (SharepointListAdapterObject)thisXDocument.<span class="label">DataAdapters</span>["Contacts"];
Dim myContacts As SharepointListAdapterObject = _
   DirectCast(_
      thisXDocument.<span class="label">DataAdapters</span>["Contacts"], _
      SharepointListAdapterObject)

In the following example, the DataAdapters property of the XDocument object is used to set a reference to a data connection to a SharePoint list called "Contacts".

SharepointListAdapterObject myContacts = 
   (SharepointListAdapterObject)thisXDocument.<span class="label">DataAdapters</span>["Contacts"];
Dim myContacts As SharepointListAdapterObject = _
   DirectCast(_
      thisXDocument.<span class="label">DataAdapters</span>["Contacts"], _
      SharepointListAdapterObject)

Remarks

To use the object returned by a DataAdaptersCollection object, you must declare and cast to the corresponding type for the kind of data connection that is defined in the form template using the Data Connections command on the Data tab. For example, to work with a data connection to a SharePoint list, you must declare and cast the object returned from the DataAdaptersCollection object to the SharepointListAdapterObject type as shown in the code sample.

Important: This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Applies to