system.mes.role.exportRolesAsCsv
Description
Exports all or selected roles as raw bytes in CSV format (UTF-8 encoded).
Streams role data from the database and formats it as CSV, including a header row whose columns
correspond to fields in RoleImportDTO. When ids is omitted, all roles are exported.
Permissions
This method requires the SYSTEM.ADMIN permission.
Syntax
system.mes.role.exportRolesAsCsv()
system.mes.role.exportRolesAsCsv(ids=["01J9YP3JBR-WQ8GWRR2-8Y879V2D"])
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
ids | String[] | Yes | The ids of the roles 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.role.exportRolesAsCsv()
system.perspective.download("roles.csv", csvBytes)
Script Console
csvBytes = system.mes.role.exportRolesAsCsv()
path = system.file.saveFile("roles.csv")
if path is not None:
system.file.writeFile(path, csvBytes)