Update Project Task in Project Online Using CSOM

Update Project Task in Project Online Using CSOM

Update Project Task in Project Online Using CSOM. In this post, you learn Update Project Task in Project Online Using CSOM and also update actual start date, Finish Date, Total Work, Percentage Complete etc using CSOM. Also, update multiple tasks with only one project publish Using CSOM. So below is complete code to Programmatically update Project task using CSOM in Project Online.

If you don’t know to add references in your solutions then follow the post below

Add  references in Solution


using (PRCLNT.ProjectContext ProjectCont = new PRCLNT.ProjectContext(OnlinePWA))//PWA Url
                SecureString passWord2 = new SecureString();
                foreach (char c in Passwords.ToCharArray()) passWord2.AppendChar(c);
                ProjectCont.Credentials = new SharePointOnlineCredentials(UserName, passWord2);
                 c => c.IncludeWithDefaultProperties( pr => pr.Assignments, pr => pr.FinishDate, pr => pr.Tasks,  pr => pr.PercentComplete, pr => pr.ProjectResources));
                var projCollection = ProjectCont.LoadQuery(ProjectCont.Projects.Where(p => p.Name == "P1"));
                PublishedProject proj2Edit = projCollection.First();
                DraftProject pp = proj2Edit.Draft;
                JobState state = ProjectCont.WaitForQueue(pp.CheckIn(true), 20);
                DraftProject projCheckedOut = proj2Edit.CheckOut();
                DraftTaskCollection tskcoll = projCheckedOut.Tasks;
                foreach (DraftTask tsk in tskcoll)
                            tsk.ActualStart = Convert.ToDateTime("ActualStart");                       
                            tsk.ActualFinish = Convert.ToDateTime("ActualFinish");                       
                            tsk.Work = "Work";                       
                            tsk.ActualWork = "ActualWork";                      
                            tsk.PercentComplete = Convert.ToInt32("PercentComplete");                      

                QueueJob qJob = ProjectCont.Projects.Update();
                ProjectCont.WaitForQueue(qJob, 20);



  1. Thank you for the example. I use a similar code to change the value of another field Start. In this case, the code works, but in the draft and published version of the project, the field Start takes a value in which the date and month are reversed. Tell me please, how to solve this problem?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!