File.SetStamp(Text, Date [, Time]) Method
Version: Available or changed with runtime version 1.0.
Sets a timestamp for a file.
Note
This method is supported only in Business Central on-premises.
Syntax
[Ok := ] File.SetStamp(Name: Text, Date: Date [, Time: Time])
Note
This method can be invoked without specifying the data type name.
Parameters
Name
Type: Text
The name of the file, including its path. When you enter the path, keep in mind 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 you want stamped on the file.
[Optional] Time
Type: Time
The time that you want stamped on the file.
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 sets timestamp for that a file that is named varFileName. The date and time are set to the current date and on your computer respectively. The code example assumes that you have created the following file: 'C:\MyFolder\MyText.txt'. The following example requires that you create the following global variables and text constant.
var
varFileName: Text;
varDate: Date;
varTime: Time;
Text000: Label 'The timestamp for this file is Date: %1 Time: %2.';
begin
VarFileName := 'C:\MyFolder\MyText.txt';
varDate := Today;
varTime := Time;
SetStamp(VarFileName, varDate, varTime);
Message(Text000, varDate, varTime);
end;