Home > DMT_Project > moveProjectToFolder
DMT_Project.moveProjectToFolder() method
Move a project to a folder
Signature
typescript
function moveProjectToFolder(projectUuid: string, folderUuid?: string): Promise<boolean>;1
Parameters
Parameter | Type | Description |
|---|---|---|
projectUuid | string | Project UUID |
folderUuid | string | (Optional) Folder UUID, which can only be a folder under the team or personal space where the current project is located. If it is |
Returns
Promise<boolean>
Whether the move is successful
Example
javascript
// 1. 记录当前工程的位置,作为移动后恢复的锚点
const info = await eda.dmt_Project.getCurrentProjectInfo();
const projectUuid = info.uuid;
const teamUuid = info.teamUuid;
const originalFolderUuid = info.folderUuid; // 可能为 undefined(团队根目录)
// 2. 创建目标文件夹,等待 1.5s 让工作区同步
const targetFolderUuid = await eda.dmt_Folder.createFolder('嘉立创示例_目标文件夹', teamUuid);
await new Promise(r => setTimeout(r, 1500));
// 3. 把当前工程移到目标文件夹下
const moved = await eda.dmt_Project.moveProjectToFolder(projectUuid, targetFolderUuid);
await new Promise(r => setTimeout(r, 1000));
// 4. 回读验证工程已落到目标文件夹
const after = await eda.dmt_Project.getCurrentProjectInfo();
const folderChanged = after?.folderUuid === targetFolderUuid;
// 5. 恢复:移回原位置(原为根目录时传 undefined)
const restored = await eda.dmt_Project.moveProjectToFolder(projectUuid, originalFolderUuid);
await new Promise(r => setTimeout(r, 1000));
console.log('moved:', moved);
console.log('folderChanged:', folderChanged);
console.log('restored:', restored);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25