This article explains steps for adding, updating or deleting a task to/from Office 365 Project Online plan schedules.
This article series focuses on working with office 365 project online plan schedule tasks using Client Side Object model approach. In the previous post, we have seen multiple ways of retrieving tasks from the project plans.
Adding a Task:
A task can be added to the Office 365 project plan schedule by the following steps.
Required project needs to be checked-out before any operation.
Task collection is retrieved from the draft project.
Task creation object is created with necessary OOB field values, and will be added to the task collection.
Then the draft project will be updated and published.
The following code snippet shows the above explained steps.
private static void AddTask()
using (ProjectContext projContext = new ProjectContext("https://nakkeerann.sharepoint.com/sites/pwa"))
projContext.Credentials = new SharePointOnlineCredentials("email@example.com", password);
var projects = projContext.Projects;
var projectId = "3a000b01-55f2-e811-afac-00155d24c70d";
var project = projects.GetById(projectId);
var draftProject = project.Draft;
var tasks = draftProject.Tasks;
TaskCreationInformation newTask = new TaskCreationInformation();
newTask.Name = "Task4";
//newTask["a"] = "";
Console.WriteLine("Task Created: " + newTask.Name);
Updating a Task:
A task can be update on the Office 365 project plan schedule by the following steps.