0

I am trying to find the schedule variance of all the projects in my Microsoft Project Server. I am using CSOM and C# to access the server, and I do get some details of the projects.

The schedule variation would require Actual Start/ End, Baseline Start/End dates. When I included the start and end date in project query to load to the project context like :

   projContext.Load(pubProj, d=> d.StartDate, d=>d.FinishDate, d=>d.Name,
d=>d.CustomFields, d=>d.Description, d=>d.Id,d=>d.Owner, 
d=>d.PercentComplete, d=>d.LastPublishedDate, d=>d.ApprovedEnd, 
d=>d.ApprovedStart);

I do see that the start and end dates are populating, but the start date varies from what I see in the Project Information on the UI. Also I could not figure out how to get the baseline dates which we would see in the Tracking view of projects.

Please can someone help me here ?

Jinith
  • 439
  • 6
  • 16

1 Answers1

0

Just figured out that the baseline dates are not properties of the project and is picked from the first main task in the project. So as soon as you have a baseline start and end date on the first task the project baseline dates are reflected in the tracking view .

if (pubProj.Tasks != null && pubProj.Tasks.Count > 0)
{
    tempProj.BaseEndDate = pubProj.Tasks[0].BaselineFinish;
    tempProj.BaseStartDate = pubProj.Tasks[0].BaselineStart;
    tempProj.BaselineDuration = (pubProj.Tasks[0].BaselineDuration != null && pubProj.Tasks[0].BaselineDuration.Length > 2) ? Convert.ToInt16(Convert.ToDecimal(pubProj.Tasks[0].BaselineDuration.Remove(pubProj.Tasks[0].BaselineDuration.Length - 1))) : 0;
    tempProj.FinishVariance = (pubProj.Tasks[0].FinishVariance != null && pubProj.Tasks[0].FinishVariance.Length > 2) ? Convert.ToInt16(Convert.ToDouble(pubProj.Tasks[0].FinishVariance.Remove(pubProj.Tasks[0].FinishVariance.Length - 1))) : 0;
}
else
{
    tempProj.BaselineDuration = 0;
    tempProj.FinishVariance = 0;
}
Shelby115
  • 2,816
  • 3
  • 36
  • 52
Jinith
  • 439
  • 6
  • 16