Home > DMT_Folder > createFolder
DMT_Folder.createFolder() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Create Folder
Signature
typescript
function createFolder(
folderName: string,
teamUuid: string,
parentFolderUuid?: string,
description?: string,
): Promise<string | undefined>;1
2
3
4
5
6
2
3
4
5
6
Parameters
Parameter | Type | Description |
|---|---|---|
folderName | string | Folder name |
teamUuid | string | Team UUID |
parentFolderUuid | string | (Optional) Parent folder UUID. If not specified, it is the root folder |
description | string | (Optional) Folder description |
Returns
Promise<string | undefined>
Folder UUID, if it is undefined creation fails
Example
javascript
// 1. 取当前工程所属团队,作为文件夹的归属
const projectInfo = await eda.dmt_Project.getCurrentProjectInfo();
const teamUuid = projectInfo.teamUuid;
// 2. 在团队根目录下创建测试文件夹
const folderUuid = await eda.dmt_Folder.createFolder('嘉立创示例_文件夹', teamUuid);
// 3. 等待工作区同步后回读,确认文件夹已落地
await new Promise(r => setTimeout(r, 1500));
const folderInfo = await eda.dmt_Folder.getFolderInfo(teamUuid, folderUuid);
console.log('folderUuid:', folderUuid);
console.log('name:', folderInfo?.name);
console.log('parentFolderUuid:', folderInfo?.parentFolderUuid === teamUuid ? '(团队根目录)' : folderInfo?.parentFolderUuid);1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14