I'm writing a script that needs to check the resume dates of resource assignments on a given task. You can see the resume dates of resource assignments in the task usage view of MS Project:
I need to check the Resume date for each assignment because they can potentially be different than the task's resume date:
In the MS Project API, the Assignment object doesn't seem to be able to access the Resume value, even though it can access most other fields for assignments.
Is there a way to access the Resume date of a Resource Assignment in code without needing to actually select the assignment in the task usage view?
The Resume date for an assignment is the next working day after the last day with Actual Work for that assignment. Here's a vba sample that should readily convert to c#:
Function FindResumeDate(a As Assignment) As Variant
If a.ActualWork = 0 Then
FindResumeDate = "NA"
Else
Dim tsvs As TimeScaleValues
Set tsvs = a.TimeScaleData(a.Start, a.Finish, pjAssignmentTimescaledActualWork, pjTimescaleDays)
Dim i As Long
i = tsvs.Count + 1
Do
i = i - 1
Loop Until i = 1 Or VarType(tsvs(i).Value) = vbDouble
Dim resDate As Date
If a.RemainingWork = 0 Then
resDate = tsvs(i).StartDate
Else
resDate = Fix(Application.DateAdd(tsvs(i).StartDate, 481))
End If
FindResumeDate = resDate
End If
End Function
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.