Export (0) Print
Expand All

XMLFileAdapterObject interface

Represents a connection to an XML file.

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

[GuidAttribute("096cd5d5-0786-11d1-95fa-0080c78ee3bb")]
public interface XMLFileAdapterObject : XMLFileAdapter2, 
	XMLFileAdapter

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 InfoPath 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.

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);
 }
}
Show:
© 2015 Microsoft