FileSubmitConnection.Execute method (XPathNavigator)

Office 2013 and later

Overrides the default Execute method to allow specifying a different source of data to submit.

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

public abstract void Execute(
	XPathNavigator input
)

Parameters

input
Type: System.Xml.XPath.XPathNavigator

An XPathNavigator that is positioned at the XML node of the form that contains the data to submit.

ExceptionCondition
WebException

The submit operation failed.

ArgumentNullException

The parameter passed to this method is a null reference (Nothing in Visual Basic).

ArgumentException

The parameter passed to this method is not valid. For example, it is of the wrong type or format.

This method overrides the default Execute method (inherited from the DataConnection base class), which submits the data that is declaratively defined in the form template. The XPathNavigator object specified for the input parameter should point to an XML element which contains the data to be submitted. The data to submit can be in specified by any DataSource object.

Setting the input parameter to a null reference (Nothing in Visual Basic) has the same effect as using the default Execute method to submit data using the declarative settings defined in the form template.

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

This type or member can be accessed from code running in forms opened in Microsoft InfoPath Filler or in a Web browser.

In the following example, the Execute(input) method is used to perform a submit operation to the SharePoint Library defined by FileSubmitConnection object to submit the contents of the UniqueValue node in the main data source of the form.

public void ExecuteInput_Clicked(object sender, ClickedEventArgs e)
{
   string UniqueValueXPath = "/my:myFields/my:UniqueValue";
   XPathNavigator mainNavigator = MainDataSource.CreateNavigator();
   XPathNavigator uniqueValueNavigator = 
      mainNavigator.SelectSingleNode(UniqueValueXPath, 
      NamespaceManager);
   FileSubmitConnection submitConnection = 
      (FileSubmitConnection)(DataConnections["SharePoint Library"]);
   submitConnection.Execute(uniqueValueNavigator);
}
Show: