Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

CSOM - How to set timephase data on an assignment?

$
0
0

This question has been asked before, but no one has given a definite answer. Since the PSI will be going away, we would appreciate an answer that tells us whether this functionality is available with CSOM and sample code.

What I am looking for is the equivalent of being able to use the statusing service in the PSI where you can set aspecific set of actual hours on a specific assignment for a specific date. The last part is the important part. I can see that CSOM lets you get assignments for a resource and that you can set the actual work at this level, but this is not timephase actual work. It is for the entire assignment. e.g the following code does it at the assignment level, not a specific date.

                    EnterpriseResource er = projContext.EnterpriseResources.GetByGuid(projectAssignment.ResourceUID);
                    string assignmentUID_String = projectAssignment.AssignmentUID.ToString();
                    projContext.Load(er.Assignments, c => c.Where(p => p.Id == new Guid(assignmentUID_String)));
                    projContext.ExecuteQuery();


                    er.Assignments[0].ActualWork = "3h";
                    er.Assignments.Update();
                    er.Assignments.SubmitAllStatusUpdates(string.Format("some comment"));

The er.Assignments has a GetTimePhase() method that looks promising, but it always returns a GeneralSecurityAccessDenied even though the account I am logged in with is an Administrator.

Let me be clear. I am not asking to "read" the timephase info. I know I can do that from OData. I am trying to "write" data back into Project to a specific assignment on a specific date. 

Also, let me be clear that I am not looking for a way to do this with Timesheets. The data I am trying to update is for Resources, which are NOT users. They do not and will not have timesheets. I'm basically looking for the equivalent of updating with hours via "Task Updates" as oppose to Timesheets.

Can someone from Microsoft please respond to this? Thanks!




Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>