Hi,
My previous question (http://social.msdn.microsoft.com/Forums/en-US/26c088e0-5f99-4b57-a07e-3c81ff4baf97/add-hours-to-task-in-project-server-2013?forum=project2010custprog) pointed me in the right direction. I still have some questions how you can modify hours that are already added (submitted) in Project Server and to add new hours (from the timesheet). I first tried this with CSOM but now I'm going to try this to achieve with the PSI. I was wondering if there are solutions for the problems I had with the CSOM because it is recommended over the PSI in project server 2013 by Microsoft. And following the website: http://msdn.microsoft.com/en-us/library/office/jj163082.aspx it should be possible to add/modify hours.
I ran into the following problems:
I only get the timesheets of the user that is currently logged in when using the following code:
private static void GetTimesheets() { var projContext = new ProjectContext("http://tfspsdemo/PWA/"); projContext.Load(projContext.TimeSheetPeriods); projContext.ExecuteQuery(); foreach (var period in projContext.TimeSheetPeriods) { projContext.Load(period.TimeSheet); projContext.ExecuteQuery(); Console.WriteLine(period.Name); } }
Impersonation is not an option because I have to pass to username and password for the corresponding user.
projContext.Credentials = new NetworkCredential("username", "password");
If anyone has suggestions for the CSOM or PSI how to achieve this, please let me know! (Or which one do you suggest PSI or CSOM?) I will be very grateful for your help/answer.
Thanks in advance