Programmatic update of Project Server timesheets is designed to be done via PSI Timesheets web service. Everything looks pretty simple until your code needs to support the whole set of Project Server Timesheet functionality. Below is the list of “non-trivial” timesheet-related tasks we managed to accomplish.
Updating task actuals in Single Entry Mode. Dealing with new tasks.
Problem - GeneralItemDoesNotExist error on QueueUpdateTimesheet web service method call. The issue was described here. The solution we've proposed was “fixing” timesheet in case if some assignments were created later than timesheet. The workaround would be any minor change of the timesheet, i.e. change the timesheet name to itself to mark the dataset row changed.
Adding new assignments in Single Entry Mode.
This operation requires the same timesheet “fixing” work (described above).
Updating task actuals in Single Entry Mode. Non-administrative tasks.
This action requires additional action – creating StatusingChangeLog row. All the properties should be properly set - ENTITY_TYPE, ENTITY_UID, PID, PROJ_UID and VALUE.
Deleting Assignment rows.
The changes dataset should be appended with new RemovedAssignments data table, which is not in dataset schema. It should contain a row with ASSN_UID column set. In addition, in case if Single Entry Mode is turned on, this action requires adding two StatusingChangeLog rows – with PID s_apid_update_needed and s_apid_removed_by_res.
Determining the erroneous state of the timesheet.
The initial dataset schema does not allow doing this. But this task can be accomplished by checking “invisible” timesheet row column TS_QUEUE_JOB_STATUS.
We’ve spent quite a lot of our time to make these things working. As usual, the working code is encapsulated to the FluentPS library.
Have fun!Read more...