Düzenle

Aracılığıyla paylaş


DAVAdapter.SubmitData(IXMLDOMNode) Method

Definition

Submits the specified DOM element or DOM document to a data adapter.

public:
 void SubmitData(Microsoft::Office::Interop::InfoPath::Xml::IXMLDOMNode ^ pData);
public void SubmitData (Microsoft.Office.Interop.InfoPath.Xml.IXMLDOMNode pData);
abstract member SubmitData : Microsoft.Office.Interop.InfoPath.Xml.IXMLDOMNode -> unit
Public Sub SubmitData (pData As IXMLDOMNode)

Parameters

pData
IXMLDOMNode

The XML data that is to be submitted.

Examples

In the following example, the SubmitData method of the DAVAdapterObject object is used to submit an XML document containing a DOM element, my:group1, to a Windows SharePoint Server document library. This code requires a SharePoint form library Data Connection named "Submit" and that my:group1 exists in the data source under the document element, for example, my:myFields.

// Get the first data adapter; a "SharePoint Library" submit adapter
DAVAdapter davAdapter = thisXDocument.DataAdapters["Submit"] as DAVAdapter;
if (davAdapter == null)
{
 thisXDocument.UI.Alert("SharePoint submit list adapter called 'Submit' was not found.");
 return;
}
// Set the file name to be the today's date (as an .xml file)
davAdapter.FileName = DateTime.Today.ToShortDateString() + ".xml";
// Get my:group1 from the data source
IXMLDOMNode group1Node = thisXDocument.DOM.selectSingleNode("/my:myFields/my:group1");
// Check if group1 exists
if (group1Node != null)
{
 if (davAdapter.SubmitAllowed)
 {
  try
  {
   davAdapter.<span class="label">SubmitData</span>(group1Node);
  }
  catch (Exception ex)
  {
   // The save failed
   thisXDocument.UI.Alert("Saving to " + davAdapter.FolderURL + " as " + davAdapter.FileName + " failed." + Environment.NewLine + "Reason: " + ex.Message);
  }
 }
 else
 {
  thisXDocument.UI.Alert("Submit is not allowed on adapter " + davAdapter.Name + ".");
 }
}
else
{
 // my:group1 does not exist
 thisXDocument.UI.Alert("my:group1 does not exist in the form.");
}

Applies to