File Explorer API

Infor Public Sector includes an API (Hansen.Core.FileManagement.FileExplorer) that you can use to work with directories and files on the server programmatically. For example, you can use this API to manage your agency files in a multi-tenant environment, where you don't have direct access to the server.

This table describes the methods that are available in the File Explorer API. All directory paths are relative to the Root directory in the File Explorer.

Method Description Parameters
AppendAllText Opens the specified file and appends the specified text.
  • path (String): Relative path of the file.
  • text (String): Text to append to the file.
CopyDirectory Copies the specified directory and all its contents to the specified destination. (Not supported in a multi-tenant environment.)
  • sourcePath (String): Relative path of the source directory.
  • destinationPath (String): Relative path of the destination directory.
CopyFile Copies the specified file to the specified destination.
  • sourcePath (String): Relative path of the file that you want to copy.
  • destinationPath (String): Relative path of the destination directory.
CreateDirectory Adds a directory.
  • path (String): Relative path of the directory that you are creating.
DeleteDirectory Deletes the specified directory and all of its contents.
  • path (String): Relative path of the directory to be deleted.
DeleteFile Deletes the specified file.
  • path (String): Relative path of the file to be deleted.
DirectoryExists Returns True if the specified directory exists.
  • path (String): Relative path of the directory.
FileExists Returns True if the specified file exists.
  • path (String): Relative path of the file.
GetConfiguredDirectories Gets a list of directories from the FileManagement configuration. Returns a collection of IpsDirectoryInfo objects. None
GetDirectories Gets all directories under the Root directory. Returns a collection of IpsDirectoryInfo objects. None
GetDirectories Gets the directories within the specified directory. Returns a collection of IpsDirectoryInfo objects.
  • path (String): Relative path of the parent directory.
  • searchPattern (String): Optional. Search pattern to match against the directory names. Can include literals and wildcards, but regular expressions are not supported.
  • searchOption (System.IO.SearchOption): Optional. Indicates whether you want to search in all subdirectories, or only the top directory.
GetDirectoryInfo Gets information about the specified directory. Returns an IpsDirectoryInfo object.
  • path (String): Relative path of the directory.
GetFileInfo Gets information about the specified file. Returns an IpsFileInfo object.
  • path (String): Relative path of the file.
GetFiles Gets the files within the specified directory. Returns a collection of IpsFileInfo objects.
  • path (String): Relative path of the parent directory.
  • searchPattern (String): Optional. Search pattern to match against the file names. Can include literals and wildcards, but regular expressions are not supported.
  • searchOption (System.IO.SearchOption): Optional. Indicates whether you want to search in all subdirectories, or only the top directory.
GetParentDirectory Gets the parent directory of the specified directory. Returns an IpsDirectoryInfo object.
  • path (String): Relative path of the directory.
HasSubDirectories Returns True if the specified directory has subdirectories.
  • path (String): Relative path of the directory.
IsDirectoryReadable Returns True if the specified directory can be read from.
  • path (String): Relative path of the directory.
IsDirectoryWritable Returns True if the specified directory can be written to.
  • path (String): Relative path of the directory.
IsFileReadable Returns True if the specified file can be read from.
  • path (String): Relative path of the file.
IsFileWritable Returns True if the specified file can be written to.
  • path (String): Relative path of the file.
MoveDirectory Moves the specified directory and all of its contents. (Not supported in a multi-tenant environment.)
  • sourcePath (String): Relative path of the directory to be moved.
  • destinationPath (String): Relative path of the directory's new location.
MoveFile Moves the specified file. (Not supported in a multi-tenant environment.)
  • sourcePath (String): Relative path of the file to be moved.
  • destinationPath (String): Relative path of the file's new location.
OpenRead Reads the specified file to a stream.
  • path (String): Relative path of the file.
OpenWrite Opens the specified file or creates a new one with write access.
  • path (String): Relative path of the file.
ReadAllBytes Returns a byte array with the contents of the specified file.
  • path (String): Relative path of the file.
ReadAllText Returns a string with the contents of the specified file.
  • path (String): Relative path of the file.
RenameDirectory Renames the specified directory. (Not supported in a multi-tenant environment.)
  • sourcePath (String): Relative path of the directory to be renamed.
  • newName (String): New name of the directory.
RenameFile Renames the specified file.
  • sourcePath (String): Relative path of the file to be renamed.
  • newName (String): New name of the file.
WriteAllBytes Writes the specified byte array to a file. If the file already exists it will be overwritten.
  • path (String): Relative path of the file.
  • bytes (String): Bytes to write to the file.
WriteAllText Writes the specified text to a file. If the file already exists it will be overwritten.
  • path (String): Relative path of the file.
  • text (String): Text to write to the file.

IpsDirectoryInfo

The Hansen.Core.FileManagement.IpsDirectoryInfo object represents a directory on the server. This table describes the properties of this object:

Property Description
ConfiguredName (String) Name of the directory as specified in the FileManagement configuration.
Created (System.DateTime) Date and time the directory was created.
FullName (String) Fully qualified name of the directory.
LastModified (System.DateTime) Date and time the directory was last modified.
Name (String) Name of the directory.
VirtualFullName (String) Fully qualified virtual name of the directory.
VirtualName (String) Virtual name of the directory.

IpsFileInfo

The Hansen.Core.FileManagement.IpsFileInfo object represents a file on the server. This table describes the properties of this object:

Property Description
Created (System.DateTime) Date and time the file was created.
Directory (Hansen.Core.FileManagement.IpsDirectoryInfo) Directory where the file is located.
Extension (String) File extension.
FullName (String) Fully qualified name of the file. (Not available in a multi-tenant environment.)
IsStandardFileSystemProvider (Boolean) Indicates whether the file uses a standard file system provider.
IsVirtual (Boolean) Indicates whether this is a virtual file, such as a file in a database file management system.
LastModified (System.DateTime) Date and time the file was last modified.
Length (Long) Size of the file in bytes.
Name (String) Name of the file.
VirtualFullName (String) Fully qualified virtual name of the file.
VirtualName (String) Virtual name of the file.