XDocuments2.New Method (Object, Int32)

Creates a new Microsoft InfoPath 2010 form based on the specified form.

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

Syntax

'Declaration
Function New ( _
    varURI As Object, _
    dwBehavior As Integer _
) As XDocument
'Usage
Dim instance As XDocuments2
Dim varURI As Object
Dim dwBehavior As Integer
Dim returnValue As XDocument

returnValue = instance.New(varURI, dwBehavior)
XDocument New(
    Object varURI,
    int dwBehavior
)

Parameters

  • varURI
    Type: System.Object

    Specifies the Uniform Resource Identifier (URI) of a form.

  • dwBehavior
    Type: System.Int32

    Default value is 1. A value that specifies how the form should be opened. The values are based on the XdDocumentVersionMode enumeration.

Return Value

Type: Microsoft.Office.Interop.InfoPath.SemiTrust.XDocument
An _XDocument object.

Implements

XDocuments.New(Object, Int32)

Remarks

The New method can only be used to 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, the new form opens in InfoPath and is ready to be filled out.

Important

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.

Examples

In the following example, the New method of the XDocumentsCollection collection is passed the URI of an existing form, and a new form is created and its associated _XDocument object returned:

XDocument newDocument;
newDocument = thisApplication.XDocuments.New(@"C:\MyForm.xml", 1);

See Also

Reference

XDocuments2 Interface

XDocuments2 Members

New Overload

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace