Hello,
For integration with a custom application I need to add hours for resources to project server 2013. These hours must be coupled to a (existing) task (and resource) in project server. Also I need the possibility to delete hours for a specific person per task.
I tried to achieve above with CSOM without succes. When getting the tasks I couldn't add hours. (First created a method that prints the information, but with this I am stuck.)
private static void GetTasks() { var projects = projContext.Projects; projContext.Load(projects); projContext.ExecuteQuery(); foreach (var project in projects) { projContext.Load(project.Tasks); projContext.ExecuteQuery(); Console.WriteLine(project.Name); foreach (var task in project.Tasks) { projContext.Load(task.Assignments); projContext.ExecuteQuery(); Console.WriteLine("\t" + task.Name); foreach (var assignment in task.Assignments) { projContext.Load(assignment.Owner, temp => temp.LoginName, temp => temp.Email); projContext.Load(assignment.Resource); projContext.ExecuteQuery(); Console.WriteLine("\t\t" + assignment.Owner.Email + " " + assignment.ActualWork); } } Console.WriteLine("-----"); Console.WriteLine(); } }
Another option I thought was getting the information from the timesheets, without succes because Timesheet remains null
private static void GetTimesheets() { var timesheets = projContext.LoadQuery(projContext.TimeSheetPeriods.IncludeWithDefaultProperties(item => item.TimeSheet)); projContext.ExecuteQuery(); foreach (var timePeriod in timesheets) { //Option one, Timesheet stays null projContext.Load(timePeriod.TimeSheet); projContext.ExecuteQuery(); //Option two, Timesheet stays null var timesheet = timePeriod.TimeSheet; projContext.Load(timesheet); projContext.ExecuteQuery(); } }
Does anyone now how to achieve this using CSOM or PSI? Maybe some examples/references to implement above requirements?
Thanks in advance