Share via

LoadingEventArgs.InputParameters property

Gets an IDictionary that contains any input parameters specified by using the /InputParameters command-line option, query parameters in a URL, or the one of the NewFromFormTemplateWithInputParameters methods.

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


Public MustOverride ReadOnly Property InputParameters As IDictionary(Of String, String)
Dim instance As LoadingEventArgs
Dim value As IDictionary(Of String, String)

value = instance.InputParameters
public abstract IDictionary<string, string> InputParameters { get; }

Property value

Type: System.Collections.Generic.IDictionary<String, String>
An IDictionary that contains input parameters.


Exception Condition

A method was called which attempted to write to the IDictionary that contains input parameters.


Input parameters consist of one or more name/value pairs separated by the ampersand (&) character that are specified when a form template is opened from the command line or a batch file using the /InputParameters command-line option. Input parameters can also be specified by using query parameters when a form template is opened from a URL.


While an IDictionary is normally read/write, InfoPath prevents calls to any methods that write to the IDictionary (such as the Add or Clear methods). Any attempts to make calls that write to the IDictionary returned by the InputParameters property will throw an InvalidOperationException.

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 code example, the InfoPath form template that contains the Loading event handler code is opened from the command line or a URL using the following syntax.


infopath.exe "C:\User Forms\DeptReport.xsn" /InputParameters "Dept=Accounting&Acct=Contoso"



Alternatively, you can open the new form and pass in input parameters from code by using the NewFromFormTemplateWithInputParameters(String, String) method of the XmlFormCollection class, the NewFromSolutionWithInputParameters(String, String) method of the ExternalApplication interface, or the NewFromSolutionWithInputParameters(Object, Object) method of the XDocumentsCollection.


The last two methods are designed for use from external automation code, and cannot be called from form code.

The InputParameters property is used from a Loading event handler to set the Department field value to "Accounting" and the Account field value to "Contoso" when the form is opened. The name/value pairs that specify the values can be passed as input parameters using the /InputParameters command-line option, URL input parameter, or NewFromFormTemplateWithInputParameters(String, String) method.

public void FormEvents_Loading(object sender, LoadingEventArgs e)
   // Be sure that the InputParameter dictionary contains
   // values before proceeding.
   if (e.InputParameters.Count != 0)
      string vDept = e.InputParameters["Dept"];
      string vAcct = e.InputParameters["Acct"];

      XPathNavigator myNav = CreateNavigator();
Public Sub FormEvents_Loading(ByVal sender As Object, _
   ByVal e As LoadingEventArgs)
   ' Be sure that the InputParameter dictionary contains
   ' values before proceeding.
   If e.InputParameters.Count <> 0 Then
      Dim vDept As String = e.InputParameters("Dept")
      Dim vAcct As String = e.InputParameters("Acct")

      Dim myNav As XPathNavigator  = CreateNavigator()
      myNav.SelectSingleNode("/my:myFields/my:Department", _
      myNav.SelectSingleNode("/my:myFields/my:Account", _
   End If
End Sub

See also


LoadingEventArgs class

LoadingEventArgs members

Microsoft.Office.InfoPath namespace