Bewerken

Delen via


File.Name() Method

Version: Available or changed with runtime version 1.0.

Gets the name of an ASCII or binary file.

Note

This method is supported only in Business Central on-premises.

Syntax

Name :=   File.Name()

Note

This method can be invoked using property access syntax.

Note

This method can be invoked without specifying the data type name.

Parameters

File
 Type: File
An instance of the File data type.

Return Value

Name
 Type: Text

Remarks

You must use the Open Method (File) to open the file before you can use this method.

Example

The following example opens a text file that is named C:\TestFolder\TestFile.txt. The Name Method (File) retrieves the name and path of the text file and stores it in the varName variable. The value in the variable is displayed in a message box. This example assumes that you have created a text file named C:\TestFolder\TestFile.txt.

var
    Testfile: File;
    varName: Text;
begin
    TestFile.Open('C:\TestFolder\TestFile.txt');  
    varName := TestFile.Name;  
    Message('The name of the file is: %1',varName);  
end;

File Data Type
Get Started with AL
Developing Extensions