This documentation is archived and is not being maintained.

XDocuments.NewFromSolution Method

Office 2007
Creates a new Microsoft Office InfoPath 2007 form based on the specified form template.

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.NewFromSolution(varURI)

expression   An expression that returns a XDocuments object.

Parameters

NameRequired/OptionalData TypeDescription
varURIRequiredVariantSpecifies the Uniform Resource Identifier (URI) of a form.

Return Value
XDocument

Remarks

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

The NewFromSolution method can only be used to create a new form based on an existing form template; it cannot be used to create a new form based on a form. To create a form from an existing form, use the New method of the XDocuments collection.

Security Level 2: 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.

Example

In the following example, the NewFromSolution method of the XDocuments collection is passed the URI of an existing form template, and a new form is created and its associated XDocument object returned:

JScript
var objXDoc;

objXDoc = Application.XDocuments.NewFromSolution("C:\\MyForm.xsn");



Show: