When I exported more than 500 tasks, I found it very slow, which was intolerable,so I’m going to use a batch to generate the file:
IList taskList = XXXXX;–from DB
int iTotal = taskList.Count;
int iBatchSize = 20;
for (int i = 0; i < iTotal; i++){
Resource rsc2 = project.Resources.Add(“Res”);
rsc2.Set(Rsc.Name, epmowner);
rsc2.Set(Rsc.Type, ResourceType.Work);
// Assign the resource desired task
ResourceAssignment assn = project.ResourceAssignments.Add(task, rsc2);
if (iTotal > 100 && i > 19 && i % iBatchSize == 0)
{
project.Save(mspriFileDir + projectName + “.mpp”, SaveFileFormat.MPP);
project = new Project(mspriFileDir + projectName+".mpp");
project.CalculationMode = CalculationMode.Manual;
}
}
But when one task have multiple Resouce Names the export task StartDate and Durationis are not what I expected ,or example, under the same branch, the same person has two upper and lower level related tasks. The last task will not start if it doesn’t finish the next task, the duration it will be 0, which is actually exported from the database 3
I hope:
Task name | Duration | Start |. … …|Resource Names
task0 6 20171101 Tom
----task1 6 20171101
--------task1-1 6 20171101
----task2 3 20171103 Jack,Tom
not like this:
Task name | Duration | Start |. … …|Resource Names
task0 6 20171101 Tom
----task1 6 20171101
--------task1-1 6 20171101
----task2 0 20171101 Jack,Tom