Edit

Share via


XmlFormCollection.NewFromFormTemplateWithInputParameters Method

Definition

Creates a new form with the specified form template and input parameters.

public:
 abstract Microsoft::Office::InfoPath::XmlForm ^ NewFromFormTemplateWithInputParameters(System::String ^ formTemplateLocation, System::String ^ inputParameters);
public abstract Microsoft.Office.InfoPath.XmlForm NewFromFormTemplateWithInputParameters (string formTemplateLocation, string inputParameters);
abstract member NewFromFormTemplateWithInputParameters : string * string -> Microsoft.Office.InfoPath.XmlForm
Public MustOverride Function NewFromFormTemplateWithInputParameters (formTemplateLocation As String, inputParameters As String) As XmlForm

Parameters

formTemplateLocation
String

The Uniform Resource Identifier (URI) of the form template on which to base the new form.

inputParameters
String

One or more name/value pairs separated by the ampersand (&) character.

Returns

An object that represents the new form.

Exceptions

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

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

The file specified for formTemplateLocation does not exist.

This method was called from an event handler for the Loading event.

Examples

The following code example shows how to create a new form by passing in the URI of a form template that contains an appropriate Loading event handler and two input parameters.

XmlForm newDocument = 
   this.Application.XmlForms.NewFromFormTemplateWithParameters(
   @"C:\User Forms\DeptReport.xsn","Dept=Accounting&Acct=Contoso");
Dim newDocument As XmlForm = _
   Me.Application.XmlForms.NewFromFormTemplateWithParameters( _
   "C:\User Forms\DeptReport.xsn","Dept=Accounting&Acct=Contoso")

Remarks

To use the input parameters that were passed to the inputParameters parameter, the form specified in the formTemplateLocation parameter must contain a Loading event handler that uses the InputParameters property of the LoadingEventArgs class to retrieve the input parameter values, and then do something with those values. For an example of how to do this, see the InputParameters property topic.

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

This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.

Applies to