XDocuments2.Open(Object, Int32) Method

Definition

Opens the specified Microsoft Office InfoPath form.

public Microsoft.Office.Interop.InfoPath.XDocument Open (object varURI, int dwBehavior = 1);
abstract member Open : obj * int -> Microsoft.Office.Interop.InfoPath.XDocument
Public Function Open (varURI As Object, Optional dwBehavior As Integer = 1) 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 Open method of the XDocumentsCollection collection is passed the URI of an existing form, and the form is opened and its associated _XDocument object returned:

XDocument document;
document = thisApplication.XDocuments.<span class="label">Open</span>(@"C:\MyForm.xml", 1);

Remarks

The Open method can only be used to open a form; it cannot be used to open a form template. To create a form from a form template, use the NewFromSolution(Object) method. To create a form based on an existing form, use the New(Object, Int32) method.

When you use the Open method, the specified form opens in InfoPath and is ready to be filled out.

Applies to