Share via


DAVAdapter.Submit method

Executes the submit operation on the associated adapter.

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

Syntax

'Declaration
Sub Submit
'Usage
Dim instance As DAVAdapter

instance.Submit()
void Submit()

Examples

In the following example, the Submit method of the DAVAdapterObject object is used to submit an XML document to a Windows SharePoint Server document library. This code requires a SharePoint form library Data Connection named "Submit".

// 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";
if (davAdapter.SubmitAllowed)
{
 try
 {
  davAdapter.Submit();
 }
 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 + ".");
}

See also

Reference

DAVAdapter interface

DAVAdapter members

Microsoft.Office.Interop.InfoPath namespace