File.GetStamp(Text, var Date [, var Time]) Method
Version: Available or changed with runtime version 1.0.
Gets the exact time that a file was last written to.
Note
This method is supported only in Business Central on-premises.
Syntax
[Ok := ] File.GetStamp(Name: Text, var Date: Date [, var Time: Time])
Note
This method can be invoked without specifying the data type name.
Parameters
Name
Type: Text
The name of the file, including the path. When you enter the path, consider these shortcuts:
- You can omit the drive designation if the file is located on the current drive.
- You can omit the full path if the file is located in the current directory.
- You can enter only the subdirectory name if the file is located in a subdirectory of the current directory.
Date
Type: Date
The date that the file was last written to.
[Optional] Time
Type: Time
The time that the file was last written to. Optional.
Return Value
[Optional] Ok
Type: Boolean
true if the operation was successful; otherwise false. If you omit this optional return value and the operation does not execute successfully, a runtime error will occur.
Example
The following example gets the date and time that a file was written to and displays the data in a message box. The code example assumes that you have created the file 'C:\MyFolder\MyText.txt'. This example requires that you create the following global variables and text constant.
var
varDate: Date;
varTime: Time;
varFileName: Text;
Text000: Label 'This document was last written to on %1 at %2.';
begin
varFileName := 'C:\MyFolder\MyText.txt';
GetStamp(VarFileName, varDate, varTime);
Message(Text000, varDate, varTime);
end;