Blog Post

Project Support Blog
2 MIN READ

Project Online: Adding tasks where you want them with Power Automate

Brian-Smith's avatar
Brian-Smith
Former Employee
Feb 03, 2020

This is a guest post from Daniel Partridge - who answered an internal enquiry at Microsoft, for a colleague who needed to add a task under a summary using Power Automate (Flow).  Great timing as Daniel was also looking at the same challenge.

In Daniel's words and pictures:

 

In order to accomplish this, I used the “Send and HTTP Request to SharePoint” action in my Power Automate flow, and the end result appears in the schedule as shown in this image:

 

The flow process would be as follows (*IMPORTANT: The REST API to use for this would be ProjectServer vs. ProjectData in the URL).  ProjectData is used for reporting - OData.

 

  • Get the Project Id (GUID)
  • Get the Id (GUID) of the Summary task
  • Checkout Project - Power Automate Project Online Action
  • Send HTTP Request to SharePoint - Power Automate SharePoint Action

HTTP POST: _api/ /Draft/Update()/Projects('ProjectGUID')/Draft/Tasks/Add()

 

Header JSON

{

  "Accept": "application/json;odata=nometadata",

  "Content-Type": "application/json"

}

 

Body JSON

{

   "parameters":

   {

      "Name": "task title",

      "Notes": "task notes",

      "Duration": "2d",

      "ParentId": "summaryTaskGUID"

   }

}

 

  • Send HTTP Request to SharePoint - Power Automate SharePoint Action

HTTP POST: _api/ProjectServer/Projects('ProjectGUID')/Draft/Update()

 

Header JSON

{

  "Accept": "application/json;odata=nometadata",

  "Content-Type": "application/json"

}

 

Body JSON

Leave blank

 

  • Check-in and publish Project - Power Automate Project Online Action

The images below show an example using the Power Automate Project Online Action for “Creates new task” which is unnecessary if you are using the Project Summary task or some other task that already exists to link to as the parent task:

 

 

 

Thanks Daniel for sharing, and I hope this helps other people using Power Automate and Project Online to get their tasks flowing into their projects just where they want them!  

Published Feb 03, 2020
Version 1.0

5 Comments

  • Deepti040890's avatar
    Deepti040890
    Copper Contributor

    Hello, 

     

    Thank you for your quick response. I have tried the exact same steps. But, except Notes field all other fields get updated but Notes field doesn't get updated. Am I doing anything wrong ? 

  • Steven de Hoog's avatar
    Steven de Hoog
    Copper Contributor

    Deepti040890 

    You would change the last part of the URI to point to the task you want to modify (include the guid just like the project) and remove the Add method and also change the method to Patch in stead of Post.

  • Steven de Hoog's avatar
    Steven de Hoog
    Copper Contributor
    I would strongly suggest adding "AddAfterId" to ensure the task gets created at the right position. "ParentId" will set the correct outline level, but doesn't influence the position within that level. Especially when adding tasks in bulk (an apply to each loop for example), omitting AddAfterId can mess up the task order.