system.mes.personnel.exportPersonnelAsCsv
Description
Exports all or selected personnel as raw bytes in CSV format (UTF-8 encoded).
Streams personnel data from the database and formats it as CSV, including a header row whose columns
correspond to fields in PersonnelImportDTO. When idsOrPaths is omitted, all personnel are exported.
Permissions
This method requires the PERSONNEL.READ.GET permission.
Syntax
system.mes.personnel.exportPersonnelAsCsv()
system.mes.personnel.exportPersonnelAsCsv(idsOrPaths=["Enterprise/Site/Operators/John Doe"])
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
idsOrPaths | String[] | Yes | The ids or paths of the personnel 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.exportPersonnelAsCsv()
system.perspective.download("personnel.csv", csvBytes)
Script Console
csvBytes = system.mes.personnel.exportPersonnelAsCsv()
path = system.file.saveFile("personnel.csv")
if path is not None:
system.file.writeFile(path, csvBytes)