Home > DMT_Folder > createFolder
DMT_Folder.createFolder() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
创建文件夹
签名
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
参数名
参数 | 类型 | 描述 |
|---|---|---|
folderName | string | 文件夹名称 |
teamUuid | string | 团队 UUID |
parentFolderUuid | string | (可选) 父文件夹 UUID,如若不指定,则为根文件夹 |
description | string | (可选) 文件夹描述 |
返回值
Promise<string | undefined>
文件夹 UUID,如若为 undefined 则创建失败
示例
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