_ExternalApplication.New method
Creates a new Microsoft InfoPath form based on a specified form.
Namespace: Microsoft.Office.Interop.InfoPath
Assembly: Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)
Syntax
'Declaration
Sub New ( _
bstrDocumentURI As String, _
dwBehavior As Integer _
)
'Usage
Dim instance As _ExternalApplication
Dim bstrDocumentURI As String
Dim dwBehavior As Integer
instance.New(bstrDocumentURI, dwBehavior)
void New(
string bstrDocumentURI,
int dwBehavior
)
Parameters
bstrDocumentURI
Type: System.StringThe string value that specifies the Uniform Resource Identifier (URI) of a form.
dwBehavior
Type: System.Int32Default value is 1. Specifies how the form should be opened. The values are based on the XdDocumentVersionMode enumeration.
Remarks
The New method can be used to only create a new form based on an existing form; it cannot be used to create a new form based on a form template. To create a form from a form template, use the NewFromSolution method.
When you use the New method, InfoPath is opened and the new form is ready to be filled out.
Note You cannot use Close to close a form that has been opened with the New method. When the New method creates a form, the name of that form is not yet known.
Examples
In the following example, which is written in the C# programming language, the New method of the ExternalApplication object is used to create a new form based on a specified form:
private void CreateFromForm()
{
ExternalApplication infoPath = new ExternalApplicationClass();
// Create an InfoPath form.
infoPath.New(@"C:\My Forms\Form1.xml", 1);
}
Note
The above example assumes that the Microsoft.Office.Interop.InfoPath namespace is being used and that the Microsoft InfoPath 3.0 Type Library is referenced.