Share via


XMLFileAdapterObject interface

Represents a connection to an XML file.

Namespace:  Microsoft.Office.Interop.InfoPath
Assembly:  Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)

Syntax

'Declaration
<GuidAttribute("096CD5D5-0786-11D1-95FA-0080C78EE3BB")> _
Public Interface XMLFileAdapterObject _
    Inherits XMLFileAdapter2
'Usage
Dim instance As XMLFileAdapterObject
[GuidAttribute("096CD5D5-0786-11D1-95FA-0080C78EE3BB")]
public interface XMLFileAdapterObject : XMLFileAdapter2

Remarks

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeXMLFileAdapter2.

The XMLFileAdapterObject object is a type of Microsoft Office InfoPath 2003 data adapter that contains all the information necessary for retrieving data from an external data source.

The XMLFileAdapterObject object provides the FileURL property, which can be used get or set the Uniform Resource Locator (URL) of the XML file that is being used an external data source.

For secondary data sources, the XMLFileAdapterObject object is accessible through the QueryAdapter property of the DataSourceObject, and the Item property of the DataAdaptersCollection collection.

DataObject objects are accessible through the DataObjects property of the XDocument object.

Examples

DataAdapters dtaAdapters;
dataAdapters = thisDocument.DataAdapters; 
XMLFileAdapterObject queryXMLFile = dataAdapters["form1"] as XMLFileAdapterObject;
if (queryXMLFile == null)
{
 thisXDocument.UI.Alert("The DataAdapter does not exist or is not an XMLFileAdapterObject.");
}
else
{
 thisDocument.UI.Alert("Query - XML file adapter"); 
 thisDocument.UI.Alert("Name: " + queryXMLFile.Name);
 thisDocument.UI.Alert("QueryAllowed: " + queryXMLFile.QueryAllowed);
 thisDocument.UI.Alert("SubmitAllowed: " + queryXMLFile.SubmitAllowed);
 thisDocument.UI.Alert("FileURL: " + queryXMLFile.FileURL);
 // Perform the query.
 try
 {
  queryXMLFile.Query();
 }
 catch (Exception ex)
 {
  thisXDocument.UI.Alert("Failed to query.\n\n" + ex.Message);
 }
 // Perform the submit.
 try
 {
  queryXMLFile.Submit();
 }
 catch (Exception ex)
 {
  thisXDocument.UI.Alert("Failed to submit.\n\n" + ex.Message);
 }
}

See also

Reference

XMLFileAdapterObject members

Microsoft.Office.Interop.InfoPath namespace