#Office365 #ProjectfortheWeb #MicrosoftTeams integration #PowerAutomate #ProjectManagement #PPM #MSProject #PowerPlatform #AdaptiveCards Part 4

December 12, 2019 at 1:22 pm | Posted in Add-on, Administration, App, Customisation, Functionality, Information | Leave a comment
Tags: , , , , , , ,

In part 4 of this series we will create a simple Power Automate Flow that posts a message to a Team when a project is overdue. For part 3 of the series, here is the link if you missed it where we looked at adding a Bot for Project for the web into Teams: https://pwmather.wordpress.com/2019/11/22/office365-projectfortheweb-microsoftteams-integration-projectmanagement-ppm-msproject-powerplatform-powervirtualagents-part-3/

This post will use Teams messages and Adaptive Cards in Teams, this will be similar to the posts I created in the summer for Project Online: https://pwmather.wordpress.com/tag/adaptive-cards/ 

Firstly create the Power Automate Flow to get the data, in this simple example I have a scheduled Flow that runs once a week, queries the Projects entity in the CDS with a filter as seen below to only return the projects that are not 100% complete and the Finish date is before todays date:

Flow1

Then an Apply to each action is used as the List Overdue Projects is more than likely to return more than one project:

Flow2

Here you can see some additional Compose actions as I calculate the days overdue and also build up a Project Link, these are used in the Post a message action. The message is switched to code view so that I could build up a HTML link. I created most of the message when in the HTML view then switched it to the code view to create the Project Link. When this runs this posts a message for each project overdue, in my example test tenant I have two test projects that are overdue:

Teams

Before we move on to the adaptive card example, I will detail the example compose actions I have:

FlowCompose

FinDateTickValue = ticks(items(‘Apply_to_each’)[‘msdyn_finish’])

TodayTickValue = ticks(utcNow())

DateDifference = div(sub(outputs(‘TodayTickValue’),outputs(‘FinDateTickValue’)),864000000000)

ProjLink = concat(‘https://project.microsoft.com/?org=cdsOrg#/taskgrid?projectId=projectId’,items(‘Apply_to_each’)[‘msdyn_projectid’])  – cdsOrg would be updated to your correct CDS org like below:

concat(‘https://project.microsoft.com/?org=orgxxxxxxx.crm11.dynamics.com#/taskgrid?projectId=’,items(‘Apply_to_each’)[‘msdyn_projectid’])

In the next example I will use the Teams Adaptive Card action to post this message as a card rather than a standard message:

FlowCard

The card is authored in JSON, I used the same process here as I documented my previous posts for Project Online, no need to hand craft the JSON, use adaptive card designer here: https://adaptivecards.io/designer. Once you have the card built and designed in the designer, copy the card JSON and paste into the Flow message input:

FlowCard2

Add the dynamic content to the JSON message as seen below to pass in the correct data based on your card design:

FlowCard2

When this Flow runs it posts cards to the Teams channel for the overdue projects as seen below:

Card1

The cards can be made to be as engaging as you like with images, text, fonts etc. this is just a basic example for this blog post.

There are many use cases for this type of simple Project for the Web and Microsoft Teams integration using Power Automate, I will look to post some other examples in the future.

#Office365 #ProjectfortheWeb #MicrosoftTeams integration #ProjectManagement #PPM #MSProject #PowerPlatform #PowerVirtualAgents Part 3

November 22, 2019 at 7:16 pm | Posted in Add-on, Administration, App, Functionality, Information, Workflow | 1 Comment
Tags: , , , , , , , ,

In part 3 of this series we will look at adding the sample bot created in part 2 in to Microsoft Teams. If you missed part 2 it can be found here: https://pwmather.wordpress.com/2019/11/20/office365-projectfortheweb-microsoftteams-integration-projectmanagement-ppm-msproject-powerplatform-part-2/

Now we have a working Power Virtual Agent (PVA) for creating projects in Project for the Web we can now embed this into other applications such as Microsoft Teams, custom web applications, Cortana, Facebook etc. Do remember that PVAs are currently only in preview and not generally available yet. For this example we will add this into Microsoft Teams. Firstly we need to publish the bot from the Publish page:

Publish

Once published at least once you will then be able to try out your bot in the demo website:

Demo

Each time you make a change to the bot, once ready you will need to publish it again. Now that it’s published we click Channels under the Manage menu, then in this example click Microsoft Teams:

Teams

Now click the Add button and this generates the App ID:

TeamsAppID

Copy the App ID for a later step. Now load the Teams App Studio (or add it to Teams if you don’t have this yet). In the App Studio click Manifest editor and the click “Create a new app”. Complete the form as required:

AppForm

Now using the left hand menu, click Bots under “2 Capabilities”:

BotSetup

Click “Set up”. Then click “Existing bot”, add the bot name then paste in the App ID copied in the previous step when adding the Teams channel in the Power Virtual Agents window and set the scope to Personal then click Save:

Existingbot

Now click on Test and distribute under “3 Finish”:

Test

Here you can install the app in Teams for testing or Download. In this example I’m downloading it then in Teams click Apps > Upload a custom app:

Upload

Once uploaded, from the Bots filter in Apps you will see the bot:

BotAdded

Click that then you will be able to Add it and it will appear in your personal Chat and you can create a project from there:

BOTinTeams

For more details see this link: https://docs.microsoft.com/en-gb/power-virtual-agents/publication-add-bot-to-microsoft-teams

I will add some more Microsoft Teams integration options for Project for the Web soon!

#Office365 #ProjectfortheWeb #MicrosoftTeams integration #ProjectManagement #PPM #MSProject #PowerPlatform Part 2

November 20, 2019 at 8:47 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Workflow | 1 Comment
Tags: , , , , , , , ,

In the last post we started looking at integration options for Project for the Web in Microsoft Teams, this post can be found here: https://pwmather.wordpress.com/2019/11/16/office365-projectfortheweb-microsoftteams-integration-projectmanagement-ppm-msproject-powerplatform-part-1/

This post continues with the Project for the Web and Microsoft Teams integration theme but this time creating a Project directly from Teams using a bot. This makes use of the new Power Virtual Agents feature that is currently in preview: https://powervirtualagents.microsoft.com/ In this post we will build a very simple Power Virtual Agent, PVA for short, that will enable to user to create a project in the Project for the Web service.

In the first part (Part 2 of the series) we create the PVA bot and Power Automate Flow. Firstly access the Power Virtual Agents preview and create a new bot, I’ve created one called “Project Creation”:

BOT

I wont cover all the possible options for the PVAs as these are well documented here: https://docs.microsoft.com/en-us/power-virtual-agents/, I will just cover the minimum to get started creating a project. Click the “Customize your greeting” button to load the default Greeting topic editor:

Topic

Here on the canvas you can create / edit the steps for the greeting topic. I’ve deleted some of the default messages, updated a message and about to add a question:

Topicedit

I’ve created my first question that the bot will ask the user:

Q1

This is taking the entire response as the answer and saving it to the projectName variable. The next question is asking for the start date:

Q2

This is identifying the responses as Date and time and saving it to the startDate variable. As you can see this added two conditions in but I will delete those as they are not required in this bot. The final question is asking the user which department is the project for. Department is a custom field I have in the project entity:

Q3

This is a multiple choice question to give the user a option to select, I’ve matched the options here that are available my custom Department Option set in the CDS. The answer will be saved to the department variable. As you can see this added three conditions in but I will delete those as they are not required in this bot. Next we need to call an action to create the project. This will call a Flow, create the Flow using the “Create a flow” option if you do not have the Flow yet:

Action

That will take you to the Flow editor with the Power Virtual Agents Flow Template loaded:

Flow

Modify this Flow as needed and update the name. Here is my Flow:

FlowSummary

Key changes highlighted below:

Updated the JSON schema to support the data the PVA is passing in:

HTTP

Added a switch action to handle the different departments:

Department

Then within each case, add a “Create a new record” CDS action to create the project, here is the Marketing project example:

Create

Pass in the details as needed, the key parts for this post is that I’m passing in the Name value and the Start Date value from the PVA bot. I’ve hard coded items like the Project Manager in this example. For other setting, see this post for details: https://pwmather.wordpress.com/2019/11/11/office365-projectfortheweb-project-request-process-using-microsoftforms-cds-and-powerautomate-projectmanagement-ppm-msproject-powerplatform/ Repeat this for each case in the switch action. The final action is the response to the PVA, this has been updated with the correct outputs that I want to post back:

Respond

For this Flow to be available, it needs to be added to a solution. To do this navigate to the Power Apps home and click Solutions > New solution and complete the form then click create. Access the new solution and click Add exiting from the command bar:

Solution

Select Flow then click Outside Solutions and select the Flow then click Add:

SolutionFlow

Now back in the PVA bot editor window, click “Call an action” again" and select the Flow that was added to the solution and set the variables:

FlowBOT

We then add another message to inform the user that the project has been created and end the conversation:

End

Save the bot and test it:

Test1

Test2

We can now see the new empty project that has been created:

Project

That’s it for part 2 of this series, in part 3 we will look at adding this bot in to Microsoft Teams. Power Virtual Agents are pretty awesome for low / no code bots, try out the preview and see what you think!

#Office365 #ProjectfortheWeb #MicrosoftTeams integration #ProjectManagement #PPM #MSProject #PowerPlatform Part 1

November 16, 2019 at 12:15 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information | 1 Comment
Tags: , , , , , ,

This is a new mini series for the new Project for the Web application that will look at various ways / examples for integrating with Microsoft Teams for improved collaboration. This blog series will talk about Project for the Web: https://pwmather.wordpress.com/tag/project-for-the-web/.

I previously posted a examples on integrating Office 365 Project Online with Microsoft Teams, here are many examples for Project Online: https://pwmather.wordpress.com/tag/microsoft-teams/. This series will build similar integrations but for Project for the Web.

In this first post, we will keep it very simple and just surface the Project in a new Team linked to the Office 365 Group used for the Project. Firstly for this example, as we want to link the Project in a Tab in a Team Channel, we will create a new Team linked to Office 365 Group. If your Project is not linked to an Office 365 Group yet, for example if you haven’t added any team members yet, access the Project and link this to an existing Office 365 Group or create a new Office 365 Group as required.  To create / link the Project to an Office 365 Group, access the Project then click “Group members” in the top right corner:

Group

Here use the menu to either create a new group or add to a group. For this example I’m going to use this project and group:

ProjGroup

This Office 365 Group doesn’t current have a Microsoft Team associated. Now jump into Microsoft Teams and click Join or create a team at the bottom left below the Teams you are a member of then click Create a team:

Teams1

Click Create from…

Createfrom

Then Office 365 group:

O365group

Scroll and find the group you want, in this example I selected the group I created for the Project:

ProjGroup

Now click Create. We now have the new Team linked to the Office 365 group associated with the project:

Team

In the General Channel I will create a new Website tab to link to the project:

Tab

The URL used here is as follows:

https://project.microsoft.com/?org=cdsOrg#/taskgrid?projectId=projectId&dynamicsUI=true

Where {cdsOrg} is the Organization project for the web is deployed to, {projectId} is the project ID for the project. The last query string on the end is dynamicsUI=true, this is to remove the Office 365 header and the left navigation pane to give a better embedded experience. Without the dynamicsUI query sting:

ProjwithNav

With the dynamicsUI query string:

WithoutNav

Back in Microsoft Teams, we can now access the Project plan inside Microsoft Teams:

ProjInTeams

This could be automated if needed but the manual steps are so simple. Next up we look at adding more Microsoft Teams integration for Project for the Web.

#ProjectOnline and adaptive cards in #MicrosoftTeams using #MicrosoftFlow to chase users for overdue timesheets #PPM #ProjectManagement #MSProject #PowerPlatform #Office365

August 28, 2019 at 4:27 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Reporting, Workflow | 1 Comment
Tags: , , , , , ,

Another example use case for adaptive cards in Microsoft Teams to add additional Office 365 Project Online integration. In this example this solution will post a card in Teams for users who have timesheets in progress that are overdue. My previous example posted to Project Owners: https://pwmather.wordpress.com/2019/08/24/projectonline-and-adaptive-cards-in-microsoftteams-using-microsoftflow-for-project-owner-actions-ppm-projectmanagement-msproject-office365-powerplatform/

This example posts to the timesheet owners who have timesheets overdue. To avoid posting to all users in Project Online, this example filters the users based on an enterprise resource custom flag field called “Timesheet Required”. The resources that need to submit timesheets have this new field set to “Yes”.

Like previous posts, I used https://adaptivecards.io/designer/ to design the card.

The Microsoft Flow can be seen below:

Flow

The Flow is triggered on a schedule then uses the Current time action to get the current time. Then a SharePoint HTTP action is used to query the ProjectData API to get a list of resources in Project Online who are required to complete timesheets:

Flow1

Next an Apply to each action is used as the previous action could return more than one resource, the output from the previous action is used for the input. Inside the Apply to each action, a SharePoint HTTP action is used to query the ProjectData API for each resource from the GetUsersForTimesheets action. In the Uri query, two variables are passed in, the resource name items(‘Apply_to_each’)[‘ResourceName’] and the current time:

Flow2

Then a condition check is used to check if there is at least one timesheet for that resource using the expression length(body(‘GetAllUsersInProgressOverdueTimesheets’)[‘value’]) :

Flow3

If there is at least one timesheet for that resource the Flow then posts a card to that resource in Microsoft Teams. This is posted to the timesheet owner using the expression items(‘Apply_to_each’)[‘ResourceEmailAddress’]. There are some dynamic values passed into the JSON too for the ResourceName items(‘Apply_to_each’)[‘ResourceName’] and count of timesheets length(body(‘GetAllUsersInProgressOverdueTimesheets’)[‘value’]):

Flow4

The card is posted to the users Flow chat as seen below:

Teams

The user will then be able to click the button to access the timesheet summary page in Project Online and update the timesheets as needed.

Another simple low / no code option for integrating Office 365 Project Online and Microsoft Teams using Microsoft Flow.

#ProjectOnline and adaptive cards in #MicrosoftTeams using #MicrosoftFlow for Project Owner actions #PPM #ProjectManagement #MSProject #Office365 #PowerPlatform

August 24, 2019 at 9:26 am | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Reporting, Workflow | 1 Comment
Tags: , , , , , ,

In my previous blog post I created an example of how a combination of Microsoft Teams, Adaptive Cards and Microsoft Flow can be used for project escalations by posting a card into a Microsoft Team for the PMO. In this post I’ve got a slightly different example that posts a card to a Project Owner to escalate to the project owner to action. For those that didn’t see my previous post, here is the link: https://pwmather.wordpress.com/2019/08/18/projectonline-and-adaptive-cards-in-microsoftteams-using-microsoftflow-for-project-escalations-ppm-projectmanagement-msproject-office365/

This example will post to the project owner when the project hasn’t been updated for the given period of time but the logic could easily be updated to another type of check. This has similar logic to the Flow I published last month: https://pwmather.wordpress.com/2019/07/31/projectonline-custom-email-notifications-using-msflow-microsoftflow-ppm-pmot-msproject-exchange-office365-powerplatform-planner-part-3/ 

Like in the previous adaptive card post, I used https://adaptivecards.io/designer/ to design this simple card, this time it’s slightly simpler for this example:

Card1

There are a few more actions in the Flow compared to the previous adaptive card example as this runs on a schedule and we need to perform an extra call to get the Project Owners email address. Here is the Flow overview:

FlowSummary

The trigger is based on a schedule, in this example it is running weekly as this example checks which projects have not be published in that time. Then the Flow uses the Get past time action to get the date in the past, for this example it’s 5 days ago. These steps can be seen below:

FlowActions1

The next action is a SharePoint HTTP action to query the ProjectData API in Project Online to get all projects that have not been published in 5 days using the get past time value and also where the projects are not 100 completed:

FlowActions2

The logic can be changed by updating the OData query in the Uri property if you wanted to get projects based on other criteria. Next the Flow uses an apply to each action as the previous action could return more than one project, the output from the previous action is used for the input:

FlowActions3

Within the apply to each action the Flow then uses another SharePoint HTTP action to query the ProjectServer API (note: not ProjectData so the account used in the connections will need access to all projects + the reporting OData API) to get the Project Owner details for the current project by passing in the ProjectId using the expression items(‘Apply_to_each’)[‘ProjectId’]:

FlowActions4

Now the Flow has all the data to post the adaptive card to the project owner using the JSON payload as seen in the action below. This is posted to the project owner using the expression body(‘GetProjectOwnerDetails’)[‘Email’]. There are some dynamic values passed into the JSON too for the ProjectName items(‘Apply_to_each’)[‘ProjectName’] and the ProjectId items(‘Apply_to_each’)[‘ProjectId’]:

FlowAction5

We also set the advanced options on this action to alert the user in Teams:

FlowAction6

When the Flow runs this will post to the project owner in Microsoft Teams, on my test Project Online instance I’m the owner for all the test projects so this posted to my Teams client. The alerts are displayed as seen below:

FlowTeamsAlerts

Cards are posted to the project owners Flow chat too as seen below for the projects I own that need updating:

FlowTeamsCards

The owner can then easily click the access project button to go and update the project/s as required.

Another simple low / no code option for integrating Office 365 Project Online and Microsoft Teams using Microsoft Flow.

#ProjectOnline and adaptive cards in #MicrosoftTeams using #MicrosoftFlow for Project escalations #PPM #ProjectManagement #MSProject #Office365

August 18, 2019 at 7:58 am | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Reporting, Workflow | 1 Comment
Tags: , , , , ,

As Microsoft Teams is the place to be currently I thought I would blog another option for integrating Office 365 Project Online data in Teams. My previous Teams post example was to create a Team and channel for a Project as seen here: https://pwmather.wordpress.com/2019/06/12/create-a-microsoftteam-for-a-projectonline-project-using-microsoftflow-office365-microsoftgraph-ppm-workmanagement-powerplatform-azuread-collaboration-automation-part1/ & here: https://pwmather.wordpress.com/2019/06/13/create-a-microsoftteam-for-a-projectonline-project-using-microsoftflow-office365-microsoftgraph-ppm-workmanagement-powerplatform-azuread-collaboration-automation-part2/ This time we will look at adaptive cards in Teams.

Adaptive cards are not new so I wont go into detail here but if you have not used adaptive cards before, start here: https://adaptivecards.io/. There are two handy Microsoft Flow Teams actions for adaptive cards:

FlowActions

Using Microsoft Flow, I’ve built a simple Flow that posts a card in the specified channel if the published project matches the criteria, in this example I’m posting a card for projects that have a red RAG status field. I designed the card using the adaptive card designer:

CardDesigner

The Flow is very simple as seen below:

Flow1

This Flow is triggered when a project is published – this is a full project publish from either Project Online Desktop or the schedule PDP. The Flow then uses the SharePoint HTTP action to query the ProjectData API:

Flow1

Update the Uri as needed for your PWA configuration / fields you might want to use. Here we also pass in the project ID for the published project.

Next is a condition action to check for a value specific, in this example we are checking if the RAGPMStatus field has a value of “Slipped and cannot mitigate [Red]”:

Flow2

If this is true, the Flow posts the card to the channel, if it’s false the Flow ends:

Flow3

I’m posting to my example PMO Team in the Project Escalations channel. Once the Team and Channel are set, then the JSON is entered. The JSON defines the card:

Flow4

As mentioned earlier on, I used the card designer to easily build my card with the correct JSON, I then copied this into the Flow action Message field then updated the content that needed to be dynamic such as the Project Name, Owner, RAG PM Status, Project description and action URLs. This is done using the expression option such as: body(‘QueryProjectStatusRAG’)[‘fieldName’]. Once a card is created, this is the output in Teams as you can see below for my two demo projects:

Teams1

Your cards will look different based on how you design them, they will probably look a lot better too! On this card I have a background image, an image on the card, some project details then a button to access the project and another button to access the project site.

Another simple example of Microsoft Teams integration for Project Online!

Create a #MicrosoftTeam for a #ProjectOnline Project using #MicrosoftFlow #Office365 #MicrosoftGraph #PPM #WorkManagement #PowerPlatform #AzureAD #Collaboration #Automation Part2

June 13, 2019 at 8:25 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Workarounds | 1 Comment
Tags: , , , , , , , , ,

Following on from my last blog post where I started to walkthrough a new Microsoft Flow I created for creating a Microsoft Team for a Project Online project, here is the final part of the Flow. For those that missed part 1, a link can be found below:

https://pwmather.wordpress.com/2019/06/12/create-a-microsoftteam-for-a-projectonline-project-using-microsoftflow-office365-microsoftgraph-ppm-workmanagement-powerplatform-azuread-collaboration-automation-part1/

In the last post we finished off where the Flow action had sent the request to the Graph API to create the new Team with the new channel and new web site tab and then discussed the 202 response and teamsAsyncOperation process. The next part of the Flow’s job is to get the new Teams webUrl and update the Team URL project level custom field in Project Online.

If the Status Code response is 202 to indicate its been accepted, the Flow them moves on to the next action which is a Parse JSON action to get the Location property from the headers output from the previous HTTP action response:

Parse JSON Action

Then with the Location value another HTTP action is used to call the Graph API:

HTTPTeamResourceLocation

This performs an HTTP GET request to the Graph API to get the targetResourceLocation property from the newly created Microsoft Team, the Location property from the previous Parse JSON action is used in the URI. The advanced options are the same for all HTTP actions where the Graph API is used so I’ve not expanded this is this post – see part 1 for details.

The next action is another Parse JSON from the previous HTTPTeamResourceLocation HTTP action message body:

Parse JSON 2

This time the targetResourceLocation property is needed. Then the final Graph API call is performed to get the webUrl for the newly create Microsoft Team with another GET request. The targetResourceLocation property from the previous Parse JSON action is used in the URI:

HTTPTeamWebUrl

The Flow then moves on to the final Parse JSON action to parse the data returned in the HTTPTeamWebUrl message body:

Parse JSON 3

The Flow now has the new Microsoft Team web URL to update the Project Online project level custom field. The next Flow action is a Checkout project action:

Checkout Project

This action will checkout the project, the expression used here for the Project Id property is items(‘Apply_to_each’)[‘ProjectId’].

The next action is a SharePoint HTTP action to perform a REST call to POST to the Project Online CSOM REST API to update the custom field, this uses the same expression in the URI items(‘Apply_to_each’)[‘ProjectId’] :

UpdateProjectTeamUrl

In the REST call data is sent in the body of the request. This contains the correct internal custom field name for the “Team URL” project field and the custom field value to update the field with, which is the webUrl from the previous Parse JSON 3 action. The internal custom field name would need to be updated to the correct field from your PWA instance.

The final action in this example Flow is Checkin and publish project:

Checkin and publish project

This action will publish the project after updating the custom field and check in the project, the expression used here for the Project Id property is items(‘Apply_to_each’)[‘ProjectId’].

Here are some projects that have been updated and have Microsoft Teams created:

Projects

Here is a Team for one of the test project – “1 Paul Mather Test Project 2”:

Team

This Team has the new Project channel and the Project Page web site tab that loads the Project Details Page from PWA:

Channel

That’s it, a simple low / no code solution to create Microsoft Teams for Office 365 Project Online projects! To use this in production it needs some additional work to handle various different scenarios but hopefully this is a good starting point for someone looking to do something similar.

I will look to provide a download link for this solution starter Flow in the next few days but will post the link on my blog.

Create a #MicrosoftTeam for a #ProjectOnline Project using #MicrosoftFlow #Office365 #MicrosoftGraph #PPM #WorkManagement #PowerPlatform #AzureAD #Collaboration #Automation Part1

June 12, 2019 at 9:52 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Workarounds | 2 Comments
Tags: , , , , , , , , ,

Following on from my Microsoft Flow theme of blog posts lately, I am a big fan of the Power Platform in general, but I love Microsoft Flow for building low / no code solutions for Office 365 Project Online. In part 1 of this blog post I will start to walkthrough a new Microsoft Flow I have created that will create a new Microsoft Team for a Project Online project with a new channel and web site tab in the channel that displays the Project PDP directly in Teams. This makes use of 2 Project level enterprise custom fields in PWA, in this example I have one flag field called “Team Required?” and one text field called “Team URL”. The flag field is used to control / request a Microsoft Team for the project and the Team URL is used to store a web URL to the newly created Microsoft Team. This Flow has a few actions, these can be seen below:

image

Inside the for each loop:

image

Inside the condition check:

image

The connections used in this Flow are:

image

The account used has full admin access to the Project Online PWA instance.

This is a scheduled Flow, I have set this to run daily, but configure the frequency as required:

image

It’s probably best to schedule it out of hours so that hopefully the projects it creates Microsoft Teams for are checked in at the time the Flow runs as it will edit the Team URL custom field for that project.

Next we set some variables, these variable are used when using the HTTP action to call the Microsoft Graph API. You will need to create an Azure AD app in the Azure Portal and grant it Group.ReadWrite.All Application access:

image

When creating the Azure AD App you will need to make note of the Application (client) ID and the Directory (tenant) ID:

image

You will also have to create a client secret for the app (keep this secure but make a note of the secret as you can’t view it after!):

image

These three strings / IDs are used in the three variables set in the Flow:

image

The next action is a REST call to the ProjectData API to get a the Project details for projects requesting a Microsoft Team but filtering out those that already have a Team created using this URL:

image

The full action details can be seen below:

image

The next  action is an Apply to each loop as the REST call could return more than one project the result array:

image

The input used is body(‘GetAllProjectsRequiringTeamCreation’)[‘value’], this is added as an expression.

The next action is another REST call but this time to the Project CSOM REST API – notice /ProjectServer rather than /ProjectData, this is the get the Project Owner’s user principal name as this is used later to set the Team / Office 365 group owner:

image

A variable is passed in to the URI to get the data for the current project, the expression used here is items(‘Apply_to_each’)[‘ProjectId’].

Then a Get user profile (V2) action is used, this is used to get the user ID:

image

The expression used here is body(‘GetProjectOwnerUPN’)[‘UserPrincipalName’]

The Flow now has all the data required to go and create the Microsoft Team, the next action is a standard Flow HTTP action:

image

image

In this action, an HTTP POST is used to post the JSON data defined in the body to the teams endpoint in the Microsoft Graph API to create the Team. Walking through the body of the request, firstly the the team template is set, in this example it is just the standard template, then the display name is set, here the items(‘Apply_to_each’)[‘ProjectName’] expression is used. The team description is then set using same text and the same expression used in the display name. Then the owner is set using the Id property in the Dynamic content from the Get user profile (v2) action. That is the basic properties set to create this team. This example creates a public team, you could look to also set the visibility property to private if you wanted a private team, the default visibility is public. In this example, a new channel is also defined, the channel display name and description is set. Within that new channel a new website tab is also defined setting the tab name and contentUrl / websiteUrl. For the URLs, this creates a web site tab with a link to the Project schedule PDP as an example, the items(‘Apply_to_each’)[‘ProjectId’] expression variable is used to dynamically pass in the correct project ID.

The next action is a condition action to check the response back from the Graph API:

image

This uses the Status Code output from the HTTP action, a 202 response indicates the API call was accepted, it doesn’t mean the process is completed as creating a team generates a teamsAsyncOperation to create the team. It is recommended to make a GET request to the Location found in the response header until that call is successful and returns the targetResourceLocation, retry every 30 seconds etc. This example Flow doesn’t perform the retry, it just attempts the call to the location and would fail if it is not completed. That would need to be handled in a production environment but in this test instance I’ve not had this fail yet (works on my machine Smile). I will offer this Flow solution starter as a download but before I do that, I will probably at least put a delay in before making the GET request to the location.

In the part 2 of the this blog post later this week, the rest of the Flow will be detailed.

Create a free website or blog at WordPress.com.
Entries and comments feeds.