Bewerken

Delen via


File.CreateTempFile([TextEncoding]) Method

Version: Available or changed with runtime version 1.0.

Creates a temporary file. This enables you to save data of any format to a temporary file. This file has a unique name and will be stored in a temporary file folder.

Note

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

Syntax

[Ok := ]  File.CreateTempFile([Encoding: TextEncoding])

Note

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

Parameters

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

[Optional] Encoding
 Type: TextEncoding
The encoding that will be used by the stream. The default encoding is MSDos.

Return Value

[Optional] Ok
 Type: Boolean

Remarks

You can use this method together with Name Method (File) and Close Method (File).

Example

This example creates a temporary file that has the text Hello and then deletes the file by using the File.Close method.

 var
    FileName: File;
begin
    FileName.CreateTempFile;  
    FileName.Write('Hello');  
    FileName.Close; 
end;

File Data Type
Get Started with AL
Developing Extensions