This topic has not yet been rated - Rate this topic

XMLFileAdapterObject Interface (Microsoft.Office.Interop.InfoPath.SemiTrust)

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)
[CLSCompliantAttribute(false)] 
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, see XMLFileAdapter2.

The XMLFileAdapterObject object is a type of Microsoft Office InfoPath 2007 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);
 }
}
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.