Table of Contents

Codeunit "ForNAV File Service"

ID 6188548

Methods

DownloadFile

Read a local file and download it to the client.

procedure DownloadFile(Path: Text, ToFile: Text)

Parameters

Name Type Description
Path Text

Path of the local file.

ToFile Text

The name to give the downloaded file.

ReadTextTask

procedure ReadTextTask(Path: Text, CodePage: Enum "ForNAV Encoding", Start: Integer, Length: Integer): Integer

Parameters

Name Type Description
Path Text
CodePage "ForNAV Encoding"
Start Integer
Length Integer

Returns

Type Description
Integer

ReadTextTask

Create a task for reading a text file.

procedure ReadTextTask(Path: Text, CodePage: Enum "ForNAV Encoding"): Integer

Parameters

Name Type Description
Path Text

Path of the local file.

CodePage "ForNAV Encoding"

Code page used when reading the file.

Returns

Type Description
Integer

Task ID for use with GetReadTextTaskResult.

ReadTextTask

Create a task for reading a text file.

procedure ReadTextTask(Path: Text): Integer

Parameters

Name Type Description
Path Text

Path of the local file.

Returns

Type Description
Integer

Task ID for use with GetReadTextTaskResult.

ReadText

procedure ReadText(Path: Text, CodePage: Enum "ForNAV Encoding", Start: Integer, Length: Integer): Text

Parameters

Name Type Description
Path Text
CodePage "ForNAV Encoding"
Start Integer
Length Integer

Returns

Type Description
Text

ReadText

Read a text file using a given codepage.

procedure ReadText(Path: Text, CodePage: Enum "ForNAV Encoding"): Text

Parameters

Name Type Description
Path Text

Path of the local file.

CodePage "ForNAV Encoding"

Code page used when reading the file.

Returns

Type Description
Text

Text content of the file.

ReadText

Read a text file.

procedure ReadText(Path: Text): Text

Parameters

Name Type Description
Path Text

Path of the local file.

Returns

Type Description
Text

Text content of the file.

ReadLinesTask

procedure ReadLinesTask(Path: Text, CodePage: Enum "ForNAV Encoding", Start: Integer, Length: Integer): Integer

Parameters

Name Type Description
Path Text
CodePage "ForNAV Encoding"
Start Integer
Length Integer

Returns

Type Description
Integer

ReadLinesTask

procedure ReadLinesTask(Path: Text, Start: Integer, Length: Integer): Integer

Parameters

Name Type Description
Path Text
Start Integer
Length Integer

Returns

Type Description
Integer

ReadLinesTask

procedure ReadLinesTask(Path: Text, CodePage: Enum "ForNAV Encoding"): Integer

Parameters

Name Type Description
Path Text
CodePage "ForNAV Encoding"

Returns

Type Description
Integer

ReadLinesTask

procedure ReadLinesTask(Path: Text): Integer

Parameters

Name Type Description
Path Text

Returns

Type Description
Integer

ReadLines

procedure ReadLines(Path: Text, CodePage: Enum "ForNAV Encoding", Start: Integer, Length: Integer): List of [Text]

Parameters

Name Type Description
Path Text
CodePage "ForNAV Encoding"
Start Integer
Length Integer

Returns

Type Description
List of [Text]

ReadLines

procedure ReadLines(Path: Text, Start: Integer, Length: Integer): List of [Text]

Parameters

Name Type Description
Path Text
Start Integer
Length Integer

Returns

Type Description
List of [Text]

ReadLines

Read a text file using a given codepage.

procedure ReadLines(Path: Text, CodePage: Enum "ForNAV Encoding"): List of [Text]

Parameters

Name Type Description
Path Text

Path of the local file.

CodePage "ForNAV Encoding"

Code page used when reading the file.

Returns

Type Description
List of [Text]

A list of lines in the text file.

ReadLines

Read a text file using a given codepage.

procedure ReadLines(Path: Text): List of [Text]

Parameters

Name Type Description
Path Text

Path of the local file.

Returns

Type Description
List of [Text]

A list of lines in the text file.

GetReadLinesTaskResult

Get result for read lines task created by ReadLinesTask.

procedure GetReadLinesTaskResult(Id: Integer, var Lines: List of [Text]): Boolean

Parameters

Name Type Description
Id Integer

Task ID from ReadLinesTask.

Lines List of [Text]

List of text that will get the lines.

Returns

Type Description
Boolean

True if the operation was successful.

ReadFromStreamTask

procedure ReadFromStreamTask(Path: Text, Start: Integer, Length: Integer): Integer

Parameters

Name Type Description
Path Text
Start Integer
Length Integer

Returns

Type Description
Integer

ReadFromStreamTask

Create task to read a binary file.

procedure ReadFromStreamTask(Path: Text): Integer

Parameters

Name Type Description
Path Text

Path of the local file.

Returns

Type Description
Integer

Task ID for use with GetReadFromStreamResult.

ReadFromStream

procedure ReadFromStream(Path: Text, FileOutStream: OutStream, Start: Integer, Length: Integer): Boolean

Parameters

Name Type Description
Path Text
FileOutStream OutStream
Start Integer
Length Integer

Returns

Type Description
Boolean

ReadFromStream

Read a binary file.

procedure ReadFromStream(Path: Text, FileOutStream: OutStream): Boolean

Parameters

Name Type Description
Path Text

Path of the local file.

FileOutStream OutStream

Stream to receive the file content.

Returns

Type Description
Boolean

True if the operation was successful.

WriteTextTask

procedure WriteTextTask(Path: Text, TextString: Text, CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer, Truncate: Boolean, InsertMode: Boolean): Integer

Parameters

Name Type Description
Path Text
TextString Text
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer
Truncate Boolean
InsertMode Boolean

Returns

Type Description
Integer

WriteTextTask

procedure WriteTextTask(Path: Text, TextString: Text, CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer): Integer

Parameters

Name Type Description
Path Text
TextString Text
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer

Returns

Type Description
Integer

WriteTextTask

procedure WriteTextTask(Path: Text, TextString: Text, CodePage: Enum "ForNAV Encoding", BOM: Boolean): Integer

Parameters

Name Type Description
Path Text
TextString Text
CodePage "ForNAV Encoding"
BOM Boolean

Returns

Type Description
Integer

WriteTextTask

procedure WriteTextTask(Path: Text, TextString: Text, Start: Integer): Integer

Parameters

Name Type Description
Path Text
TextString Text
Start Integer

Returns

Type Description
Integer

WriteTextTask

procedure WriteTextTask(Path: Text, TextString: Text): Integer

Parameters

Name Type Description
Path Text
TextString Text

Returns

Type Description
Integer

AppendTextTask

procedure AppendTextTask(Path: Text, TextString: Text, CodePage: Enum "ForNAV Encoding", BOM: Boolean): Integer

Parameters

Name Type Description
Path Text
TextString Text
CodePage "ForNAV Encoding"
BOM Boolean

Returns

Type Description
Integer

AppendTextTask

procedure AppendTextTask(Path: Text, TextString: Text): Integer

Parameters

Name Type Description
Path Text
TextString Text

Returns

Type Description
Integer

InsertTextTask

procedure InsertTextTask(Path: Text, TextString: Text, CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer): Integer

Parameters

Name Type Description
Path Text
TextString Text
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer

Returns

Type Description
Integer

InsertTextTask

procedure InsertTextTask(Path: Text, TextString: Text, Start: Integer): Integer

Parameters

Name Type Description
Path Text
TextString Text
Start Integer

Returns

Type Description
Integer

WriteText

procedure WriteText(Path: Text, TextString: Text, CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer, Truncate: Boolean, InsertMode: Boolean)

Parameters

Name Type Description
Path Text
TextString Text
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer
Truncate Boolean
InsertMode Boolean

WriteText

procedure WriteText(Path: Text, TextString: Text, CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer)

Parameters

Name Type Description
Path Text
TextString Text
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer

WriteText

procedure WriteText(Path: Text, TextString: Text, CodePage: Enum "ForNAV Encoding", BOM: Boolean)

Parameters

Name Type Description
Path Text
TextString Text
CodePage "ForNAV Encoding"
BOM Boolean

WriteText

procedure WriteText(Path: Text, TextString: Text, Start: Integer)

Parameters

Name Type Description
Path Text
TextString Text
Start Integer

WriteText

procedure WriteText(Path: Text, TextString: Text)

Parameters

Name Type Description
Path Text
TextString Text

InsertText

procedure InsertText(Path: Text, TextString: Text, CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer)

Parameters

Name Type Description
Path Text
TextString Text
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer

InsertText

procedure InsertText(Path: Text, TextString: Text, Start: Integer)

Parameters

Name Type Description
Path Text
TextString Text
Start Integer

AppendText

procedure AppendText(Path: Text, TextString: Text, CodePage: Enum "ForNAV Encoding", BOM: Boolean)

Parameters

Name Type Description
Path Text
TextString Text
CodePage "ForNAV Encoding"
BOM Boolean

AppendText

procedure AppendText(Path: Text, TextString: Text)

Parameters

Name Type Description
Path Text
TextString Text

WriteLinesTask

procedure WriteLinesTask(Path: Text, Lines: List of [Text], CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer, Truncate: Boolean, InsertMode: Boolean): Integer

Parameters

Name Type Description
Path Text
Lines List of [Text]
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer
Truncate Boolean
InsertMode Boolean

Returns

Type Description
Integer

WriteLinesTask

procedure WriteLinesTask(Path: Text, Lines: List of [Text], CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer): Integer

Parameters

Name Type Description
Path Text
Lines List of [Text]
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer

Returns

Type Description
Integer

WriteLinesTask

procedure WriteLinesTask(Path: Text, Lines: List of [Text], CodePage: Enum "ForNAV Encoding", BOM: Boolean): Integer

Parameters

Name Type Description
Path Text
Lines List of [Text]
CodePage "ForNAV Encoding"
BOM Boolean

Returns

Type Description
Integer

WriteLinesTask

procedure WriteLinesTask(Path: Text, Lines: List of [Text], Start: Integer): Integer

Parameters

Name Type Description
Path Text
Lines List of [Text]
Start Integer

Returns

Type Description
Integer

WriteLinesTask

procedure WriteLinesTask(Path: Text, Lines: List of [Text]): Integer

Parameters

Name Type Description
Path Text
Lines List of [Text]

Returns

Type Description
Integer

AppendLinesTask

procedure AppendLinesTask(Path: Text, Lines: List of [Text], CodePage: Enum "ForNAV Encoding", BOM: Boolean): Integer

Parameters

Name Type Description
Path Text
Lines List of [Text]
CodePage "ForNAV Encoding"
BOM Boolean

Returns

Type Description
Integer

AppendLinesTask

procedure AppendLinesTask(Path: Text, Lines: List of [Text]): Integer

Parameters

Name Type Description
Path Text
Lines List of [Text]

Returns

Type Description
Integer

InsertLinesTask

procedure InsertLinesTask(Path: Text, Lines: List of [Text], CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer): Integer

Parameters

Name Type Description
Path Text
Lines List of [Text]
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer

Returns

Type Description
Integer

InsertLinesTask

procedure InsertLinesTask(Path: Text, Lines: List of [Text], Start: Integer): Integer

Parameters

Name Type Description
Path Text
Lines List of [Text]
Start Integer

Returns

Type Description
Integer

AppendLines

procedure AppendLines(Path: Text, Lines: List of [Text], CodePage: Enum "ForNAV Encoding", BOM: Boolean)

Parameters

Name Type Description
Path Text
Lines List of [Text]
CodePage "ForNAV Encoding"
BOM Boolean

AppendLines

procedure AppendLines(Path: Text, Lines: List of [Text])

Parameters

Name Type Description
Path Text
Lines List of [Text]

WriteLines

procedure WriteLines(Path: Text, Lines: List of [Text], CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer, Truncate: Boolean, InsertMode: Boolean)

Parameters

Name Type Description
Path Text
Lines List of [Text]
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer
Truncate Boolean
InsertMode Boolean

WriteLines

procedure WriteLines(Path: Text, Lines: List of [Text], CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer)

Parameters

Name Type Description
Path Text
Lines List of [Text]
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer

WriteLines

procedure WriteLines(Path: Text, Lines: List of [Text], Start: Integer)

Parameters

Name Type Description
Path Text
Lines List of [Text]
Start Integer

WriteLines

procedure WriteLines(Path: Text, Lines: List of [Text], CodePage: Enum "ForNAV Encoding", BOM: Boolean)

Parameters

Name Type Description
Path Text
Lines List of [Text]
CodePage "ForNAV Encoding"
BOM Boolean

WriteLines

procedure WriteLines(Path: Text, Lines: List of [Text])

Parameters

Name Type Description
Path Text
Lines List of [Text]

InsertLines

procedure InsertLines(Path: Text, Lines: List of [Text], CodePage: Enum "ForNAV Encoding", BOM: Boolean, Start: Integer)

Parameters

Name Type Description
Path Text
Lines List of [Text]
CodePage "ForNAV Encoding"
BOM Boolean
Start Integer

InsertLines

procedure InsertLines(Path: Text, Lines: List of [Text], Start: Integer)

Parameters

Name Type Description
Path Text
Lines List of [Text]
Start Integer

WriteFromStreamTask

procedure WriteFromStreamTask(Path: Text, FileInStream: InStream, Start: Integer, Truncate: Boolean, InsertMode: Boolean): Integer

Parameters

Name Type Description
Path Text
FileInStream InStream
Start Integer
Truncate Boolean
InsertMode Boolean

Returns

Type Description
Integer

WriteFromStreamTask

procedure WriteFromStreamTask(Path: Text, FileInStream: InStream): Integer

Parameters

Name Type Description
Path Text
FileInStream InStream

Returns

Type Description
Integer

AppendFromStreamTask

procedure AppendFromStreamTask(Path: Text, FileInStream: InStream): Integer

Parameters

Name Type Description
Path Text
FileInStream InStream

Returns

Type Description
Integer

InsertFromStreamTask

procedure InsertFromStreamTask(Path: Text, FileInStream: InStream, Start: Integer): Integer

Parameters

Name Type Description
Path Text
FileInStream InStream
Start Integer

Returns

Type Description
Integer

AppendFromStream

procedure AppendFromStream(Path: Text, FileInStream: InStream)

Parameters

Name Type Description
Path Text
FileInStream InStream

InsertFromStream

procedure InsertFromStream(Path: Text, FileInStream: InStream, Start: Integer)

Parameters

Name Type Description
Path Text
FileInStream InStream
Start Integer

WriteFromStream

procedure WriteFromStream(Path: Text, FileInStream: InStream)

Parameters

Name Type Description
Path Text
FileInStream InStream

WriteFromStream

procedure WriteFromStream(Path: Text, FileInStream: InStream, Start: Integer, Truncate: Boolean, InsertMode: Boolean)

Parameters

Name Type Description
Path Text
FileInStream InStream
Start Integer
Truncate Boolean
InsertMode Boolean

ScanDirTask

procedure ScanDirTask(Path: Text, SearchPattern: Text, Recursive: Boolean): Integer

Parameters

Name Type Description
Path Text
SearchPattern Text
Recursive Boolean

Returns

Type Description
Integer

ScanDir

procedure ScanDir(Path: Text, SearchPattern: Text, Recursive: Boolean, var ForNavFileDirectory: Record "ForNAV File Directory" temporary): Boolean

Parameters

Name Type Description
Path Text
SearchPattern Text
Recursive Boolean
ForNavFileDirectory Record "ForNAV File Directory" temporary

Returns

Type Description
Boolean

GetScanDirTaskResult

procedure GetScanDirTaskResult(Id: Integer, var ForNavFileDirectory: Record "ForNAV File Directory" temporary): Boolean

Parameters

Name Type Description
Id Integer
ForNavFileDirectory Record "ForNAV File Directory" temporary

Returns

Type Description
Boolean

CreateDirectoryTask

procedure CreateDirectoryTask(Path: Text): Integer

Parameters

Name Type Description
Path Text

Returns

Type Description
Integer

CreateDirectory

procedure CreateDirectory(Path: Text)

Parameters

Name Type Description
Path Text

FileExistTask

procedure FileExistTask(Path: Text): Integer

Parameters

Name Type Description
Path Text

Returns

Type Description
Integer

FileExist

procedure FileExist(Path: Text): Boolean

Parameters

Name Type Description
Path Text

Returns

Type Description
Boolean

DirectoryExistTask

procedure DirectoryExistTask(Path: Text): Integer

Parameters

Name Type Description
Path Text

Returns

Type Description
Integer

DirectoryExist

procedure DirectoryExist(Path: Text): Boolean

Parameters

Name Type Description
Path Text

Returns

Type Description
Boolean

CopyTask

procedure CopyTask(SourcePath: Text, DestinationPath: Text): Integer

Parameters

Name Type Description
SourcePath Text
DestinationPath Text

Returns

Type Description
Integer

CopyTask

procedure CopyTask(SourcePath: Text, DestinationPath: Text, OverWrite: Boolean): Integer

Parameters

Name Type Description
SourcePath Text
DestinationPath Text
OverWrite Boolean

Returns

Type Description
Integer

Copy

procedure Copy(SourcePath: Text, DestinationPath: Text)

Parameters

Name Type Description
SourcePath Text
DestinationPath Text

Copy

procedure Copy(SourcePath: Text, DestinationPath: Text, OverWrite: Boolean)

Parameters

Name Type Description
SourcePath Text
DestinationPath Text
OverWrite Boolean

MoveTask

procedure MoveTask(SourcePath: Text, DestinationPath: Text): Integer

Parameters

Name Type Description
SourcePath Text
DestinationPath Text

Returns

Type Description
Integer

Move

procedure Move(SourcePath: Text, DestinationPath: Text)

Parameters

Name Type Description
SourcePath Text
DestinationPath Text

SetCurrentDir

procedure SetCurrentDir(Path: Text)

Parameters

Name Type Description
Path Text

SetAutoCreateDir

Set if directories should be created automatically. This is used when you try to write a file to a subdirectory that does not exist.

procedure SetAutoCreateDir(Value: Boolean)

Parameters

Name Type Description
Value Boolean

New value of this setting.

DeleteDirectoryTask

Delete a directory. You can only delete an empty directory unless the Recursive parameter is true.

procedure DeleteDirectoryTask(Path: Text, Recursive: Boolean): Integer

Parameters

Name Type Description
Path Text

Path of the local file.

Recursive Boolean

Delete all files and subdirectories. Be careful with this parameter.

Returns

Type Description
Integer

Task ID for use with .

DeleteDirectory

Delete a directory. You can only delete an empty directory unless the Recursive parameter is true.

procedure DeleteDirectory(Path: Text, Recursive: Boolean)

Parameters

Name Type Description
Path Text

Path of the local file.

Recursive Boolean

Delete all files and subdirectories. Be careful with this parameter.

DeleteFileTask

Delete a file.

procedure DeleteFileTask(Path: Text): Integer

Parameters

Name Type Description
Path Text

Path of the local file.

Returns

Type Description
Integer

Task ID for use with .

DeleteFile

Delete a File.

procedure DeleteFile(Path: Text)

Parameters

Name Type Description
Path Text

Path of the local file.

GetText

procedure GetText(lines: List of [Text]): Text

Parameters

Name Type Description
lines List of [Text]

Returns

Type Description
Text

LastError

procedure LastError(): Text

Returns

Type Description
Text

SetErrorAction

procedure SetErrorAction(ErrorAction: Enum "ForNAV File Error Action")

Parameters

Name Type Description
ErrorAction "ForNAV File Error Action"

SetTimeOut

procedure SetTimeOut(Milliseconds: Integer)

Parameters

Name Type Description
Milliseconds Integer

SetDevice

Set the device name for file operations. This is the equivalient to the direct printer name when printing. The device name is used to determine which service shoud handle the job.

procedure SetDevice(Device: Text)

Parameters

Name Type Description
Device Text

RunTasks

Run all the created tasks.

procedure RunTasks()

GetTaskError

Get the error message from a task

procedure GetTaskError(Id: Integer): Text

Parameters

Name Type Description
Id Integer

Task identifier

Returns

Type Description
Text

The error message if the task is found. Otherwise, it returns an empty text.

GetTaskError

Get the error message from a task

procedure GetTaskError(Id: Integer, var ErrorMessage: Text): Boolean

Parameters

Name Type Description
Id Integer

Task identifier

ErrorMessage Text

Error message from the task

Returns

Type Description
Boolean

True if the task was found. Otherwise, it returns false.

GetFileExistsTaskResult

procedure GetFileExistsTaskResult(Id: Integer, var Result: Boolean): Boolean

Parameters

Name Type Description
Id Integer
Result Boolean

Returns

Type Description
Boolean

GetDirExistsTaskResult

procedure GetDirExistsTaskResult(Id: Integer, var Result: Boolean): Boolean

Parameters

Name Type Description
Id Integer
Result Boolean

Returns

Type Description
Boolean

GetReadFromStreamTaskResult

procedure GetReadFromStreamTaskResult(Id: Integer, fileOutStream: OutStream): Boolean

Parameters

Name Type Description
Id Integer
fileOutStream OutStream

Returns

Type Description
Boolean

GetReadTextTaskResult

procedure GetReadTextTaskResult(Id: Integer, var TextString: Text): Boolean

Parameters

Name Type Description
Id Integer
TextString Text

Returns

Type Description
Boolean

GetWaitingTaskCount

procedure GetWaitingTaskCount(): Integer

Returns

Type Description
Integer

GetTaskResultCount

procedure GetTaskResultCount(): Integer

Returns

Type Description
Integer

HasTaskResult

procedure HasTaskResult(Id: Integer): Boolean

Parameters

Name Type Description
Id Integer

Returns

Type Description
Boolean

See also