XDocuments2.New(Object, Int32) Method

Definition

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

public:
 Microsoft::Office::Interop::InfoPath::SemiTrust::XDocument ^ New(System::Object ^ varURI, int dwBehavior);
public Microsoft.Office.Interop.InfoPath.SemiTrust.XDocument New (object varURI, int dwBehavior);
abstract member New : obj * int -> Microsoft.Office.Interop.InfoPath.SemiTrust.XDocument
Public Function New (varURI As Object, dwBehavior As Integer) As XDocument

Parameters

varURI
Object

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

dwBehavior
Int32

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

Returns

An _XDocument object.

Implements

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.<span class="label">New</span>(@"C:\MyForm.xml", 1);

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(Object) 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.

Applies to