Skip to main content
Version: V3 (Ignition 8.3)

system.mes.personnel.exportDepartmentsAsCsv

Description

Exports all or selected departments as raw bytes in CSV format (UTF-8 encoded). Streams department data from the database and formats it as CSV, including a header row whose columns correspond to fields in DepartmentImportDTO. When idsOrPaths is omitted, all departments are exported.

Permissions

This method requires the PERSONNEL.READ.GET permission.

Syntax

system.mes.personnel.exportDepartmentsAsCsv()
system.mes.personnel.exportDepartmentsAsCsv(idsOrPaths=["Enterprise/Site/Maintenance"])

Parameters

ParameterTypeNullableDescription
idsOrPathsString[]YesThe ids or paths of the departments to export. Omit to export all.

Returns

A byte array (byte[]) containing the raw byte data of the CSV export (UTF-8 encoded).

Code Examples

Perspective

csvBytes = system.mes.personnel.exportDepartmentsAsCsv()
system.perspective.download("departments.csv", csvBytes)

Script Console

csvBytes = system.mes.personnel.exportDepartmentsAsCsv()
path = system.file.saveFile("departments.csv")
if path is not None:
system.file.writeFile(path, csvBytes)