#ProjectOnline and #AzureDevOps integration using #MicrosoftFlow #Office365 #PPM #AzureBoards #MSProject #PowerPlatform #ProjectManagement

I’ve posted quite a few posts for Project Online using Microsoft Flow recently so here is another! The last one was to chase / prompt users for in progress overdue timesheets, if you didn’t see this, here it is: https://pwmather.wordpress.com/2019/08/28/projectonline-and-adaptive-cards-in-microsoftteams-using-microsoftflow-to-chase-users-for-overdue-timesheets-ppm-projectmanagement-msproject-powerplatform-office365/

This time we will look at integrating Office 365 Project Online with Azure DevOps using my favourite Power Platform application Microsoft Flow. The Flow can be seen below:

Flow

I have two Project Online Enterprise custom fields to support this process. A new project level text custom field called “Azure DevOps Project” to hold the DevOps project name and a new task level flag field called “Managed In DevOps?” to flag which tasks are managed in DevOps. Project Level field seen here in my test project:

Project

Task Level:

Tasks

In this example test project, the process has run already for tasks 2 to 6 as you can see the task names have updated with the prefix “DevOps_itemId_{id}_” and here are the test project tasks in Azure DevOps:

DevOps

When the Flow runs, Task 4 and Task 6 will be added to the backlog as Epics in this example based on the process used in this test Azure DevOps project:

DevOps2

The tasks in the project are also updated with the prefix:

Task2

Now we will walkthrough the Flow actions. This is triggered on a schedule, in this example it runs daily, then the first action used is a SharePoint HTTP action to query the Project Reporting API to get the Project details for all Projects linked to the Azure DevOps projects. In this example, the Flow is fixed to one Azure DevOps project but you can have multiple Project Online projects creating tasks in the one Azure DevOps project. For additional DevOps projects, create additional Flows / extend as required.

Flow1

Then an apply to each action is used as the first action could return multiple projects if there are multiple projects in Project Online that have an Azure DevOps Project custom field value of “Paul Mathers Test Project”. The results from the GetProjectDetails action is passed in, then for each project in the dataset another SharePoint HTTP action is used to query the Project Reporting API to get all tasks for the current project where the task is tagged with “Yes” for the new “Managed in DevOps?” custom field and where the task name doesn’t already have the “DevOps_” prefix. The Project ID is passed into the Uri using the expression: items(‘Apply_to_each_project’)[‘ProjectId’]

Flow3

Then there is a condition action to check if there is at least 1 task in the results from the GetTasksForDevOps action:

Flow4

If the condition check is true, the Project is checked out using the Project Online Checkout project action, the project Id is passed in using the expression items(‘Apply_to_each_project’)[‘ProjectId’] then another Apply to each action is used and the output from the GetTasksForDevOps action is passed in:

Flow5

Two actions will run inside this apply to each action for each task returned in the GetTasksForDevOps action. Inside this apply to each action the Azure DevOps Create a work item action is used. The account name, project and work item type are set and fixed – set the work item type as needed based on the process used in the DevOps project. The title is dynamic using the expression items(‘Apply_to_each_task’)[‘TaskName’]:

Flow6

There are other properties you can set in the advanced options if required:

Flow7

The final action inside the Apply to each task action is another SharePoint HTTP action, this time to send a PATCH request to the Project Online CSOM REST API to update the task name. The following expressions are used in the Uri items(‘Apply_to_each_project’)[‘ProjectId’] and items(‘Apply_to_each_task’)[‘TaskId’]. In the Body the task name details are inlcuded, the Id of the newly created work item is passed in from the dynamic content and also the task name using the expression items(‘Apply_to_each_task’)[‘TaskName’]:

Flow8

Once the apply to each task action is completed, the final action in the true part of the condition action is the Project Online Checkin and publish project action. The project Id is passed in using the expression items(‘Apply_to_each_project’)[‘ProjectId’]Flow9

The account used in the SharePoint connection will need access to to Project Online Reporting API and also edit access to all projects. The account used in the Project Online connection will also need edit access to all projects.

That’s it, another simple no code solution for Office 365 Project Online using Microsoft Flow from the Power Platform. This is a simple example that could be extended a lot based on your requirements but hopefully this will provide you a good starting point or give you some inspiration on how to achieve your integration requirements.

Comments are closed.

Create a free website or blog at WordPress.com.

Up ↑