How to generate analysis report by opening an existing project programmatically via API

Hi,

I want to use Trados API to do project automation. Currently I am familiar with many tasks.

But for analysis report, I have a question. 

Currently, If I run a new project, I know using the following method to generate a report out.

AutomaticTask analyzeTask = project.RunAutomaticTask(targetFiles.GetIds(), AutomaticTaskTemplateIds.AnalyzeFiles);

Guid reportId = analyzeTask.Id;
project.SaveTaskReportAs(reportId, filePath, Sdl.ProjectAutomation.Core.ReportFormat.Excel);

But I want just to open an existing project and only want to generate the analysis report, how to to do that, I don't know how to get the report ID without running the analysis (the exisitng project has run the analysis task).

I am using two versions, Trados 2019 and Trados 2024, both version do not have such API doc about this part.

Thanks,