We have always updated timephased data in Microsoft Project using PSI (impersonation) and are trying to mimic this solution with CSOM to allow integration with Project Online. Much to our dismay we have yet to find a solution due to security restrictions with timephased data.
We can read TimePhase quite well:
//create context... var context = new ProjectContext(ProjectSite); //login... var securePassword = new SecureString(); foreach (char c in user.Password) securePassword.AppendChar(c); context.Credentials = new SharePointOnlineCredentials(userName, securePassword); //load web... context.Load(context.Web); //load enterprise resources... context.Load(context.EnterpriseResources); context.ExecuteQuery(); //read timephase for enterprise resource... var timePhase = context.EnterpriseResources.Assignments.GetTimePhase(start, end); context.Load(timePhase.Assignments); context.ExecuteQuery(); /* NOTE: this will fail (GeneralSecurityAccessDenied) if the enterprise resource is not associated to the context user, however, if the context user is the assignment owner we seem to be able to read the TimePhase regardless of who the enterprise resource is. */ //update and submit actual work on timePhase... timePhase.Assignments.ActualWork = "12h"; timePhase.Assignments.SubmitStatusUpdates("CSOM Update"); SessionManager.ProjectOnlineContext.ExecuteQuery(); /* NOTE: this will fail (GeneralSecurityAccessDenied) if the enterprise resource is not associated to the context user and we have not found a way around this. */
We have the following issues:
- TimePhase data can only be read for the Context User or for assignments where the Context User is the Assignment Owner
- TimePhase data cannot be updated for resources other than the Context User.
Our solution requires connecting to Project Online as one user to update timephased data for all resources in any given project. The security restrictions prevent us from performing this kind of integration.
Anyone have any thoughts, solutions, or workarounds?