1
votes

I'm trying to add timesheet entries against some specific task which is available in the MS Project Server 2013. I have ways of creating TASK in Project Server using REST endpoints, but could not find a way straight forward for the timesheet. I have gathered few details out of some scrutiny at my end:

To See the Complete Meta Data: 
http://>/PWA/_api/ProjectData/$metadata - You can get the field details, Where as I need to know in specific the Entity for TimeSheet.

To See the Complete Time Sheet Period Available:
http://>/PWA/_api/ProjectServer/TimeSheetPeriods - You can see all the available TimeSheet Periods.

I know TimeSheet stays as separate entity and doesn't belong to usual Project Entities.

My Query here to know in specific the Entity that is dealt for timesheet add & update. Please help me with endpoints including the save, publish and checkout!

2

2 Answers

1
votes

How are you adding the tasks? Http requests? Did you develop some app?

I tried a few ways to add actuals to timesheets already created using REST endpoints, via Postman, without success. It always responds with this error: "The security validation for this page is invalid.", I think I'm missing some headers.

This endpoints were as close as i got:

Submit Timesheet
POST - http://>/pwa/_api/ProjectServer/TimeSheetPeriods('periodid')/TimeSheet/submit(comment)

Update Timesheet
POST - http://>/pwa/_api/ProjectServer/TimeSheetPeriods('periodid')/TimeSheet/update()

I saw this endpoints here.

Hope this helps!

1
votes

Incase anyone is still struggling with this as I was.... here's what worked for me. To replace the actual work for a given day in a task - to enter your time:

Uri:

http://<sitecollection>/<site>/_api/ProjectServer/TimeSheetPeriods('periodid')/TimeSheet/Lines('lineid')/Work('yyyy-MM-dd') 

Method: PATCH

Headers:

 Accept - application/json;odata=verbose

 Content-type - application/json;odata=verbose

 Odata-version - 3.0

 If-Match: *

Body:

{
"__metadata": {
"type": "PS.TimeSheetWork"
},
"ActualWork": "10"
}

I entered in my times as 10 hrs.