none
CSOM - How to set timephase data on an assignment? RRS feed

  • Question

  • 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 a specific 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!



    Tuesday, September 22, 2015 5:16 PM

Answers

  • My client opened up a premier ticket about this and the official response is that this can be done, but the methods like: GetTimePhase() only work for getting data about the currently logged in user. Although I have not tried this myself because that was not my use case. In my case I need an admin account to be able to set Task Updates for other "resources" that are NOT users in the system. This is currently not supported with CSOM.

    Since this is NOT supported with CSOM, I would not expect the functionality in the Statusing methods of the existing PSI api to be deprecated until there is parity on the new API.

    Crossing my fingers, since my client heavily relies on this functionality.

    Friday, October 16, 2015 3:38 PM

All replies

  • While waiting for a definitive answer from Microsoft:

    As far as we know, there is no possibility in CSOM (by now, maybe in later releases...) to get or set timephased data for assignments.

    Best Regards | Power2plan | https://www.power2plan.com

    Wednesday, September 23, 2015 12:55 PM
  • I'll add my name to the list people who want this.  Any updates would be appreciated?

    Does Microsoft monitor these forums?  If so, please respond with an ETA for this critical functionality.


    ScoutwestInc

    Thursday, October 15, 2015 11:11 PM
  • My client opened up a premier ticket about this and the official response is that this can be done, but the methods like: GetTimePhase() only work for getting data about the currently logged in user. Although I have not tried this myself because that was not my use case. In my case I need an admin account to be able to set Task Updates for other "resources" that are NOT users in the system. This is currently not supported with CSOM.

    Since this is NOT supported with CSOM, I would not expect the functionality in the Statusing methods of the existing PSI api to be deprecated until there is parity on the new API.

    Crossing my fingers, since my client heavily relies on this functionality.

    Friday, October 16, 2015 3:38 PM
  • To update the timephase info make sure that the resource you are logged in as is the assignment owner. This should solve your issue. All assignments that are updated via the CSOM should have the CSOM credentials as the assignment owner. 
    Monday, October 26, 2015 6:53 PM
  • I'm working on a similar requirement too. The GetTimePhase() seems to work fine in our case except for when the resource is a generic resource. In this case, no StatusAssignment is being created by EPM for that assignment versus StatusAssignments automatically being created for non-generic resources. Has anyone worked on adding actual work hours per day for generic resources and succeeded?
    Wednesday, March 8, 2017 10:40 AM