LoadingEventArgs.InputParameters Property

Gets an IDictionary containing any input parameters specified using the /InputParameters command-line option, or specified using query parameters in a URL.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

Syntax

'Declaration
'Usage

Property Value

An IDictionary containing input parameters.

Exceptions

Exception type Condition

InvalidOperationException

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

Remarks

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 using query parameters when a form template is opened from a URL.

Note

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 Office InfoPath 2007 or in a Web browser.

Example

In the following example, an InfoPath form template is opened from either the command line or URL using the following syntax.

Command-line:

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

URL:

https://server/sites/team/forms/DeptReport.xsn?Dept=Accounting

The InputParameters property is used from a Loading event handler to set the Department field value to the value "Accounting" which was passed using the /InputParameters command-line option or URL input parameter.

public void FormEvents_Loading(object sender, LoadingEventArgs e)
{
   string vDept = e.InputParameters["Dept"];

   XPathNavigator myNav = CreateNavigator();
   myNav.SelectSingleNode("/my:myFields/my:Department",
      NamespaceManager).SetValue(vDept);
}
Public Sub FormEvents_Loading(ByVal sender As Object, _
   ByVal e As LoadingEventArgs)
   Dim vDept As String = e.InputParameters("Dept")

   Dim myNav As XPathNavigator  = CreateNavigator()
   myNav.SelectSingleNode("/my:myFields/my:Department",
      NamespaceManager).SetValue(vDept)
End Sub

See Also

Reference

LoadingEventArgs Class
LoadingEventArgs Members
Microsoft.Office.InfoPath Namespace