Office js Office Javascript API:MS Project标识父任务id和子任务id

Office js Office Javascript API:MS Project标识父任务id和子任务id,office-js,office-addins,ms-project,Office Js,Office Addins,Ms Project,我正在构建MS Project Web加载项。使用下面的函数作为其他函数的基础,我能够检索任务、id和资源名称 // Get the maximum task index, and then get the task GUIDs. async getTasks(guids: string[]): Promise<any[]> { return await Promise.all( guids.map(async guid => await this.ge

我正在构建MS Project Web加载项。使用下面的函数作为其他函数的基础,我能够检索
任务、id和资源名称

// Get the maximum task index, and then get the task GUIDs.
async getTasks(guids: string[]): Promise<any[]> {
    return await Promise.all(
        guids.map(async guid => await this.getTask(guid))
    );
}

async getTaskGuids(maxIndex: number): Promise<string[]> {
    const guids = [];
    for (let i = 0; i <= maxIndex; i++) {
        guids.push(await this.getTaskGuid(i));
    }
    return guids;
}
//获取最大任务索引,然后获取任务GUID。
异步gettask(guids:string[]):Promise


现在我需要确定任务是子任务还是缩进任务。确定这一点的最佳方法是什么。任何示例代码都非常有用。请帮助使用
getTaskFieldAsync
方法获取任务的特定字段值。例如,这将返回任务的名称(例如1、2、3等):

另请参见task属性以确定任务是否为摘要。集合可能与属性一样有用


作为参考,请参阅关于使用JavaScript创建项目外接程序的说明。

我必须说,您为我节省了很多时间!!非常感谢。
_projDoc.getTaskFieldAsync(taskGuid, Office.ProjectTaskFields.OutlineLevel,
    function (asyncResult) {
        if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
            text.value = text.value + "Outline Level: "
                + asyncResult.value.fieldValue + "\n";
        }
        else {
            logMethodError("getTaskFieldAsync", asyncResult.error.name,
                           asyncResult.error.message);
        }
    }
);