Export (0) Print
Expand All

XmlForm.New property

Gets a value that specifies whether a form is new.

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

public abstract bool New { get; }

Property value

Type: System.Boolean
true if the form is new; otherwise false.

The New property behaves differently depending on whether the new form is created in Microsoft InfoPath or in a Web browser.

In a Web browser, the New property is set to true when a new form is created. The property is set to false only when an existing form is opened.

In InfoPath, the New property is set to true when a new form is created. The property is set to false as soon as the form is successfully saved. The property is also set to false when an existing form is opened.

NoteNote

The New property is equivalent to the IsNew property of the XDocument object in the COM/Scripting object model, and to the IsNew property of the _XDocument2 interface of the InfoPath 2003 compatible managed code object model.

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.

This type or member can be accessed from code running in forms opened in Microsoft InfoPath Filler or in a Web browser.

The following code example shows a pattern for using the New property to conditionally run code depending on whether the form is new.

if (this.New)
{
   // Code to run if form is new.
}
else
{
   // Code to run if form is not new.
}

Community Additions

Show:
© 2014 Microsoft