Home > DMT_Project > createProject
DMT_Project.createProject() 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 Project
Signature
function createProject(
projectFriendlyName: string,
projectName?: string,
teamUuid?: string,
folderUuid?: string,
description?: string,
collaborationMode?: EDMT_ProjectCollaborationMode,
): Promise<string | undefined>;2
3
4
5
6
7
8
Parameters
Parameter | Type | Description |
|---|---|---|
projectFriendlyName | string | Project friendly name |
projectName | string | (Optional) Project name, which cannot be duplicated. Only letters |
teamUuid | string | (Optional) Team UUID. If not specified, it defaults to personal. In an environment where personal projects do not exist, a team UUID must be specified |
folderUuid | string | (Optional) Folder UUID. If not specified, it is the root folder |
description | string | (Optional) Project description |
collaborationMode | (Optional) Project collaboration mode. If the team permission does not require the project to set a collaboration mode, this parameter will be ignored |
Returns
Promise<string | undefined>
Project UUID, if it is undefined creation fails
Example
// 1. 创建测试工程(友好名带时间戳避免重名,名称与团队留空走默认)
const projectUuid = await eda.dmt_Project.createProject(
`嘉立创示例_工程 ${Date.now()}`,
undefined,
undefined,
undefined,
'嘉立创示例:工程创建演示',
);
// 2. 等待工作区同步后回读,确认工程已落地
await new Promise(r => setTimeout(r, 1500));
const brief = await eda.dmt_Project.getProjectInfo(projectUuid);
const folderLabel = !brief?.folderUuid ? '(根目录)' : brief.folderUuid;
console.log('projectUuid:', projectUuid);
console.log('friendlyName:', brief?.friendlyName);
console.log('folderUuid:', folderLabel);2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18