DAVAdapter.SubmitData-Methode
Sendet das angegebene DOM-Element bzw. DOM-Dokument an einen Datenadapter.
Namespace: Microsoft.Office.Interop.InfoPath
Assembly: Microsoft.Office.Interop.InfoPath (in microsoft.office.interop.infopath.dll)
Syntax
'Declaration
<DispIdAttribute(12)> _
Sub SubmitData ( _
<InAttribute> pData As IXMLDOMNode _
)
'Usage
Dim instance As DAVAdapter
Dim pData As IXMLDOMNode
instance.SubmitData(pData)
[DispIdAttribute(12)]
void SubmitData (
[InAttribute] IXMLDOMNode pData
)
Parameter
- pData
Die XML-Daten, die gesendet werden sollen.
Beispiel
Im folgenden Beispiel dient die SubmitData-Methode des DAVAdapterObject-Objekts zum Senden eines XML-Dokuments, das das DOM-Element my:group1 enthält, an die Windows SharePoint Server-Dokumentbibliothek. Dieser Code erfordert eine SharePoint-Formularbibliothek vom Typ Datenverbindung mit dem Namen "Submit" und ferner, dass das Element my:group1 in der Datenquelle unter dem Dokumentelement, z. B. my:myFields, vorhanden ist.
// 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.SubmitData(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.");
}
Siehe auch
Referenz
DAVAdapter-Schnittstelle
DAVAdapter-Member
Microsoft.Office.Interop.InfoPath-Namespace