# FileName Property (SaveEvent Object)

A read-only property that returns a string that represents the file name to be used in the OnSaveRequest event.

expression.FileName

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

If the IsSaveAs property of the SaveEvent object is true, and a save operation has not yet occurred, the FileName property returns an empty string. If the IsSaveAs property is true and a save operation has already occurred, the value returned by the FileName property is the file name under which the form was saved. If the SaveEvent object represents a save operation (that is, the IsSaveAs property of the SaveEvent object is false), the FileName property returns the same value as the URI property of the XDocument object.

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 FileName property of the SaveEvent object is used in a notification to the user before a save operation:

    XDocument.UI.Alert("You are about to save the following file: " + eventObj.FileName);

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp