English
Fx.netdisk
About 912 wordsAbout 3 min
2026-01-09
1. exportNpathByFolderId Export network disk npath
Export network path
Fx.netdisk.exportNpathByFolderId(<string nodeCategory>, <array folderIDs>, <string employeeId>)
Request parameters
Request Body
| Parameter Name | object | Description | Required |
|---|---|---|---|
| nodeCategory | string | Folder type (Company, Personal, Shared) | Y |
| folderIDs | array[string] | List of folder IDs | Y |
| employeeId | string | Employee ID | Y |
Return Parameters
| Parameter Name | object | Description |
|---|---|---|
| isError | boolean | Error flag |
| data | object | |
| message | string | Message |
| data | object | Description |
|---|---|---|
| fileMessageInfos | object |
| fileMessageInfos | object | Description |
|---|---|---|
| FileId | File List[object] | File information list |
| FileId | object | Description |
|---|---|---|
| nPath | string | File nPath |
| fileName | string | File name |
| fileSize | integer | File size |
| fileExtension | string | File extension |
Return an example
{
"isError" : false,
"data" : {},
"message" : ""
}Code examples
def (Boolean error, Map data, String message) = Fx.netdisk.exportNpathByFolderId("Company", ["476d9244b9304c8abfde59d0f8274933","903d7c1172e24d4198136ebfada198a1"], 1000)
if (error) {
log.info("error :" + message)
} else {
log.info(data['fileMessageInfos'])
}Notice
- Multiple folder IDs can be input, and the output files are the npaths of all files under these folders.
2. List the files in this cloud storage folder
List the network disk folder
Fx.netdisk.list(<String nodeCategory>, <String dir>, <String order>, <Integer desc>, <Integer start>, <Integer limit>, <Integer folder>, <Integer showEmpty>, <String employeeId>)
Request parameters
Request Body
| Parameter Name | Type | Description | Required |
|---|---|---|---|
| nodeCategory | String | Folder type (company, personal, shared) | Y |
| dir | String | Folder name | Y |
| order | String | Sort field (name, time, size; defaults to name) | Y |
| desc | Integer | Default ascending order; set to 1 for descending order | Y |
| start | Integer | Pagination start position (0-based) | Y |
| limit | Integer | Number of items to query (default: 1000, recommended maximum: 1000) | Y |
| folder | Integer | Whether to return only folders (0: return all, 1: return only folders with path field) | Y |
| showEmpty | Integer | Whether to return dir_empty attribute (0: no, 1: yes) | Y |
| employeeId | String | Employee ID | Y |
Return Parameters
| Parameter Name | APIResult | Description |
|---|---|---|
| isError | boolean | Indicates whether an error exists |
| data | object | Returned data |
| message | string | Message |
| data | object | Returned data |
|---|---|---|
| emptyDir | boolean | Indicates if it's an empty directory |
| fileMessageInfos | array[object] | List of file information |
| folderMessageInfos | array[object] | List of folder information |
| fileMessageInfos | object | Description |
|---|---|---|
| fileExtension | string | File extension |
| fileName | string | File name |
| fileSize | integer | File size |
| nPath | string | File path |
| folderMessageInfos | object | Description |
|---|---|---|
| fileSize | integer | Folder size |
| folderName | string | Folder name |
Return an example
{
"isError": false,
"data": {
"emptyDir": false,
"fileMessageInfos": [
{
"fileExtension": "txt",
"fileName": "example.txt",
"fileSize": 2048,
"nPath": "/files/example.txt"
},
{
"fileExtension": "jpg",
"fileName": "image.jpg",
"fileSize": 4096,
"nPath": "/files/image.jpg"
}
],
"folderMessageInfos": [
{
"fileSize": 0,
"folderName": "Documents"
},
{
"fileSize": 0,
"folderName": "Images"
}
]
},
"message": "success"
}Code examples
String nodeCategory = "Company"
String dir = "Alibaba Java Development Manual"
String orderField = "name"
Integer desc = 1
Integer start = 0
Integer limit = 10
Integer folder = 0
Integer showEmpty = 1
Integer employeeId = 1017
def(Boolean error, Map data, String message) = Fx.netdisk.list(nodeCategory, dir, orderField, desc, start, limit, folder, showEmpty, employeeId)
if (error) {
log.info("error:" + message)
} else {
List fileMessageInfos = data["fileMessageInfos"] as List
log.debug(fileMessageInfos)
}Notice
- The user must have access permissions to this folder.
3. saveFileToDir Save files to the specified directory in cloud storage
Save the file to a specified folder in the cloud storage
Fx.netdisk.saveFileToDir(<array departmentIds>, <string path>, <string fileName>, <integer category>, <string folderPath>, <boolean autoCreateDir>, <boolean allowReName>, <boolean takeOwnership>)
Request parameters
Request Body
| Parameter Name | Type | Description | Required |
|---|---|---|---|
| departmentIds | array[string] | User's department IDs | Y |
| path | string | File path to be saved in the cloud drive (currently only enterprise file types are supported) | Y |
| fileName | string | File name with extension | Y |
| category | integer | Cloud drive folder type: 1-Company, 2-Personal, 3-Shared (Shared type is currently not supported) | Y |
| folderPath | string | Cloud drive folder path, starting with '/' and ending with folder name | Y |
| autoCreateDir | boolean | Whether to automatically create missing directories iteratively | Y |
| allowReName | boolean | Whether to allow incremental renaming of files | Y |
| takeOwnership | boolean | Privilege escalation operation to obtain cloud drive administrator permissions | Y |
Return Parameters
| Parameter Name | APIResult | Description |
|---|---|---|
| isError | boolean | Whether an error occurred |
| data | object | |
| message | string | Response message |
| data | object | Description |
|---|---|---|
| fileName | string | File name |
| ei | string | Enterprise ID |
| employeeId | integer | Employee ID |
| ea | string | Enterprise account |
| allowReName | boolean | Whether renaming is allowed |
| folderId | string | Folder ID |
| fileId | string | File ID |
Return an example
{
"isError": false,
"data": {
"fileName": "sonar-project",
"ei": "90325",
"employeeId": 1000,
"ea": "90325",
"allowReName": true,
"folderId": "339cf3396af84405bd9171947cd0b5ef",
"fileId": "3e2beed837e04df185e1683b43cbf17b"
},
"message": "success"
}Code examples
// Department IDs the user belongs to (can be empty, used when ordinary users need to save files to department folders)
List<Integer> departmentIds;
// Path of the file to be saved to the cloud drive (currently only enterprise files are supported, i.e., files prefixed with N_ or TN_)
String path = "N_202304_10_f438201727394b018e62e0ba48b6f349.pdf";
// File name (must include the file extension; total file name length must not exceed 128 characters, and extension length must not exceed 20 characters)
String fileName = "test15.pdf";
// Cloud drive folder type (1: Company, 2: Personal, 3: Shared; currently, saving to shared folders is not supported)
Integer category = 1;
// File path (absolute path, must start with / and end with the file name; supports up to 9 nested levels)
String folderPath = "/2023/04/10/Contract";
// Whether to automatically create missing directories in the path (default: false)
Boolean autoCreateDir = true;
// Whether to allow incremental renaming of files (e.g., test.pdf -> test(1).pdf, incrementing sequentially; default: false)
Boolean allowReName = true;
// Override permission to obtain cloud drive administrator privileges (used for ordinary users to save files to company folders; use with caution!!!)
Boolean takeOwnership = false;
def (boolean error, Map data, String message) = Fx.netdisk.saveFileToDir(departmentIds, path, fileName, category, folderPath, autoCreateDir, allowReName, takeOwnership);
if (error) {
log.info("error:" + message)
} else {
log.info("data:" + data)
}