Skip to content

KVSMEDIFileService#

Summary: Interface for file service operations. Here is an example of how to use this interface: var KVSMEDEBillingFileServiceSetup: Record KVSMEDEBillingFileServiceSetup; IFileService: Interface KVSMEDIFileService; FileServiceSetupNotFoundErr: Label 'The file service setup is not found'; EncodingTok: Label 'UTF-8', Locked = true; local procedure WriteFile(FilePath: Text; var InStream: InStream) begin if not KVSMEDEBillingFileServiceSetup.Get() then Error(FileServiceSetupNotFoundErr); KVSMEDEBillingFileServiceSetup.BuildNewFileServiceImpl(IFileService); IFileService.WriteFile(filePath, inStream, EncodingTok); end;

Procedures#

Init(Record KVSMEDHttpServiceParameter) :#

Summary: Initializes the service with the given parameters. Use KVSMEDEBillingFileServiceSetup.BuildNewFileService to create a new instance of the service.

procedure Init(var TempKVSMEDHttpServiceParameter: Record "KVSMEDHttpServiceParameter" temporary): 

Parameters:

  • TempKVSMEDHttpServiceParameter: The HTTP service parameters.

Ping() : Boolean#

Summary: Pings the service to check if it is reachable.

procedure Ping(): Boolean

Returns: True if the service is reachable, otherwise false.

ReadFile(Text, OutStream) :#

Summary: Reads a file from the given file path.

procedure ReadFile(FilePath: Text; var OutStream: OutStream): 

Parameters:

  • FilePath: The path of the file to read.
  • OutStream: The output stream to write the file content to.

ReadFile(Text, OutStream, Text) :#

Summary: Reads a file from the given file path with the specified encoding.

procedure ReadFile(FilePath: Text; var OutStream: OutStream; EncodingName: Text): 

Parameters:

  • FilePath: The path of the file to read.
  • OutStream: The output stream to write the file content to.
  • EncodingName: The name of the encoding to use.

DeleteFile(Text) :#

Summary: Deletes a file at the given file path.

procedure DeleteFile(FilePath: Text): 

Parameters:

  • FilePath: The path of the file to delete.

DeleteFiles(Text, Text, Enum KVSMEDFileSearchOption) :#

Summary: Deletes files in the given directory that match the search pattern.

procedure DeleteFiles(DirPath: Text; SearchPattern: Text; KVSMEDFileSearchOption: Enum "KVSMEDFileSearchOption"): 

Parameters:

  • DirPath: The path of the directory.
  • SearchPattern: The search pattern to match files.
  • KVSMEDFileSearchOption: The search option to use.

ExistsFile(Text) : Boolean#

Summary: Checks if a file exists at the given file path.

procedure ExistsFile(FilePath: Text): Boolean

Parameters:

  • FilePath: The path of the file to check.

Returns: True if the file exists, otherwise false.

WriteFile(Text, InStream) :#

Summary: Writes a file to the given file path.

procedure WriteFile(FilePath: Text; var InStream: InStream): 

Parameters:

  • FilePath: The path of the file to write.
  • InStream: The input stream to read the file content from.

WriteFile(Text, InStream, Text) :#

Summary: Writes a file to the given file path with the specified encoding.

procedure WriteFile(FilePath: Text; var InStream: InStream; EncodingName: Text): 

Parameters:

  • FilePath: The path of the file to write.
  • InStream: The input stream to read the file content from.
  • EncodingName: The name of the encoding to use.

WriteFile(Text, InStream, Text, Text) :#

Summary: Writes a file to the given file path with the specified encoding and source encoding.

procedure WriteFile(FilePath: Text; var InStream: InStream; EncodingName: Text; sourceEncodingName: Text): 

Parameters:

  • FilePath: The path of the file to write.
  • InStream: The input stream to read the file content from.
  • EncodingName: The name of the encoding to use.
  • sourceEncodingName: The name of the source encoding.

MoveFile(Text, Text, Boolean) :#

Summary: Moves a file from the source file path to the target file path.

procedure MoveFile(SourceFilePath: Text; TargetFilePath: Text; Override: Boolean): 

Parameters:

  • SourceFilePath: The source file path.
  • TargetFilePath: The target file path.
  • Override: Indicates whether to override the target file if it exists.

CopyFile(Text, Text, Boolean) :#

Summary: Copies a file from the source file path to the target file path.

procedure CopyFile(SourceFilePath: Text; TargetFilePath: Text; Override: Boolean): 

Parameters:

  • SourceFilePath: The source file path.
  • TargetFilePath: The target file path.
  • Override: Indicates whether to override the target file if it exists.

GetDirectories(Text, Text, Enum KVSMEDFileSearchOption) : List#

Summary: Gets the directories in the given directory that match the search pattern.

procedure GetDirectories(DirPath: Text; SearchPattern: Text; KVSMEDFileSearchOption: Enum "KVSMEDFileSearchOption"): List

Parameters:

  • DirPath: The path of the directory.
  • SearchPattern: The search pattern to match directories.
  • KVSMEDFileSearchOption: The search option to use.

Returns: A list of directories that match the search pattern.

GetFiles(Text, Text, Enum KVSMEDFileSearchOption) : List#

Summary: Gets the files in the given directory that match the search pattern.

procedure GetFiles(DirPath: Text; SearchPattern: Text; KVSMEDFileSearchOption: Enum "KVSMEDFileSearchOption"): List

Parameters:

  • DirPath: The path of the directory.
  • SearchPattern: The search pattern to match files.
  • KVSMEDFileSearchOption: The search option to use.

Returns: A list of files that match the search pattern.

ExistDirectory(Text) : Boolean#

Summary: Checks if a directory exists at the given directory path.

procedure ExistDirectory(DirPath: Text): Boolean

Parameters:

  • DirPath: The path of the directory to check.

Returns: True if the directory exists, otherwise false.

CreateDirectory(Text) :#

Summary: Creates a directory at the given directory path.

procedure CreateDirectory(DirPath: Text): 

Parameters:

  • DirPath: The path of the directory to create.

DeleteDirectory(Text, Boolean) :#

Summary: Deletes a directory at the given directory path.

procedure DeleteDirectory(DirPath: Text; Recursive: Boolean): 

Parameters:

  • DirPath: The path of the directory to delete.
  • Recursive: Indicates whether to delete the directory recursively.

GetLastResponseInfo(Record KVSMEDHttpResponseBuffer) :#

Summary: Gets the last response information.

procedure GetLastResponseInfo(var TempKVSMEDHttpResponseBuffer: Record "KVSMEDHttpResponseBuffer" temporary): 

Parameters:

  • TempKVSMEDHttpResponseBuffer: The HTTP response buffer.

MoveDirectory(Text, Text) :#

Summary: Moves a directory from the source directory path to the target directory path.

procedure MoveDirectory(SourceDirPath: Text; TargetDirath: Text): 

Parameters:

  • SourceDirPath: The source directory path.
  • TargetDirath: The target directory path.

GetDirectoryInfo(Text) : Record#

procedure GetDirectoryInfo(DirPath: Text): Record KVSMEDFileSystemInfo

GetFileInfo(Text) : Record#

procedure GetFileInfo(FilePath: Text): Record KVSMEDFileSystemInfo