IsCancelled Property

Microsoft Office InfoPath

A read/write property that provides additional information for use in the OnSaveRequest event in conjunction with the ReturnStatus property.

expression.IsCancelled

expression    Required. An expression that returns a reference to a SaveEvent object.

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.

Remarks

When closing InfoPath, the user is prompted to save the document if the IsDirty property of the XDocument object is true. If the IsCancelled property is true, InfoPath will be prevented from closing if the save operation fails (that is, the ReturnStatus property is false).

Note  This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.

Example

In the following example, the IsCancelled property of the SaveEvent object is used to ensure that the document does not close if the save operation was cancelled:

eventObj.IsCancelled = eventObj.PerformSaveOperation();
if (eventObj.IsCancelled) 
    return;
eventObj.ReturnStatus = true;