I want to display the work hours of all days from 29/5 to 30/6 but in the interval. It contains Saturdays and Sundays (non-working days). I use TimeScaleData
but it auto-stops when it sees a non-working day. I try to add(1) to the finish day but it still stops, so I can't display the work hours correctly.
Microsoft.Office.Interop.MSProject.Application app = new Microsoft.Office.Interop.MSProject.Application();
app.FileOpenEx(Path, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
PjPoolOpen.pjPoolReadWrite, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
Microsoft.Office.Interop.MSProject.Project pj = app.ActiveProject;
foreach(Resource re in pj.Resources)
{
foreach (Assignment assign in re.Assignments)
{
double h = 0;
var tsvs = assign.TimeScaleData("5/29/2017", "7/1/2017", MSProject.PjAssignmentTimescaledData.pjAssignmentTimescaledWork, MSProject.PjTimescaleUnit.pjTimescaleDays, 1);
try
{
foreach (TimeScaleValue tsv in tsvs)
{
for (int i = 0; i < totalday ; i++)
{
h += Convert.ToDouble(tsv.Value); //sum all value
}
}
}
catch { }
}
}