#ProjectOnline custom #email notifications using #MSFlow #MicrosoftFlow #PPM #PMOT #MSProject #Exchange #Office365 #PowerPlatform #Planner Part 3

July 31, 2019 at 12:01 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Reporting, Workflow | 1 Comment
Tags: , , , , , , , , ,

It’s been a while since I published the last post in this mini series due to getting carried away with other Microsoft Flow goodness for Project Online. The previous post in this custom email notification series can be found below:

https://pwmather.wordpress.com/2019/04/30/projectonline-custom-email-notifications-using-msflow-microsoftflow-ppm-pmot-msproject-exchange-office365-powerplatform-part-2/

In the final part of this email notification series we send an email with a list of projects that have not been published in the defined period, in this example it’s set to 5 days. The Flow also creates a task in Microsoft Planner for the user to chase the project owners to update their project plans. The Flow summary can be seen below:

FlowSummary

The trigger is based on a schedule, in this example it is running weekly. Then the Flow uses the Get past time action to get the date in the past, in this example 5 days ago. A compose action is then used to get todays date in the required format. These steps can be seen below:

Flow1

The Flow then use the SharePoint HTTP action to query the ProjectData API to get the list of Projects where the last published date is on or before the past time date, in this case 5 days ago. The logic here would be changed for your requirements, for example you would also filter out projects that were completed / closed. The next action is a Create HTML table action, here we just pass in the results from the HTTP action as seen in the tooltip displayed in the screenshot below:

Flow2

The final 2 actions in this Flow create the Planner task and then send the email. We pass in some variables to create the Planner task, in this example we use the output from the Today action to use todays date in the Title and used to set the due date. The task gets assigned to me in this example so I would put my PMO hat on, this would be assigned to someone in the organisation who would be checking project plan quality etc. Then the Flow sends an email, typically this could go to an individual, likely the same person the Planner task is assigned to, or it could go to a multiple people or a group / distribution list etc. In the body on the email the output from the create HTML table action is used and also the task Id for the new planner task:

Flow3

When this Flow runs, this results in a new Planner task being created in the selected Planner plan:

PlannerTask

Then the email is sent out:

Email

As you can see, the email contains a table of test projects from my test Project Online instance that have not been published in the last 5 days and also a link to the task I have assigned in Planner.

Look out for more Microsoft Flow / PowerApps examples for Project Online in the future. For previous examples I have done, this links includes most: https://pwmather.wordpress.com/tag/power-platform/

Advertisements

Download example #MicrosoftFlow for Syncing #MSProject #Roadmap Row Item Status with #ProjectOnline Task Status #CDS #PowerPlatform #MSFlow #REST #SharePoint #WorkManagement #Office365

June 19, 2019 at 11:17 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Reporting, Workarounds | Comments Off on Download example #MicrosoftFlow for Syncing #MSProject #Roadmap Row Item Status with #ProjectOnline Task Status #CDS #PowerPlatform #MSFlow #REST #SharePoint #WorkManagement #Office365
Tags: , , , , , , ,

Following on from a recent blog post where I demonstrated an example Microsoft Flow for syncing the Roadmap row item status with the associated Office 365 Project Online Task status, I have now made this solution starter Flow available as a package that can be downloaded and imported. For those of you that missed the previous blog post, a link can be found below here: https://pwmather.wordpress.com/2019/05/27/sync-msproject-roadmap-row-item-status-with-projectonline-task-status-using-microsoftflow-cds-powerplatform-msflow-rest-sharepoint-workmanagement-office365/

FlowImage

The Flow package can be downloaded from the Microsoft Gallery here: https://gallery.technet.microsoft.com/Flow-to-Sync-Roadmap-item-44174a4b

Once downloaded the Flow can be imported, here is a Microsoft Flow blog post on exporting and importing Flow packages: https://flow.microsoft.com/en-us/blog/import-export-bap-packages/

Once imported and the connections all set – this will require a Flow P1 or P2 license as it uses the CDS connector, ensure the account has the correct access to Project Online and the CDS, open the flow and update the trigger and actions as these will currently point to one of my demo tenants:

  1. Update the “When a project is published” trigger with your PWA URL
  2. Update the “GetTaskHealth” action the correct site address for your PWA URL
  3. Update the “GetTaskHealth” action Uri to use the correct task level field, replace “RoadmapHealth” as needed
  4. Update the Switch action to use the correct task custom field – the expression would be items(‘Apply_to_each’)[‘FieldName’] – replace the field name with the correct task field
  5. Ensure the Case statements are updated to match the possible values in your custom field and map to the correct roadmap status value:
      • On Track = 0
      • Potential Problem = 1
      • At Risk = 2
      • Complete = 10
      • Not Set = 100
  6. Update the “List records” action to point to the correct environment
  7. Update the “Update a record” action to point to the correct environment

Now save the Flow and test it.

Hopefully you find this useful as a solution starter.

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.

Sync #MSProject #Roadmap Row Item Status with #ProjectOnline Task Status using #MicrosoftFlow #CDS #PowerPlatform #MSFlow #REST #SharePoint #WorkManagement #Office365

May 27, 2019 at 9:36 pm | Posted in Administration, Configuration, Functionality, Information, Reporting | 1 Comment
Tags: , , , , , , ,

At the recent Microsoft PPM Summit in Prague last week, Chris Boyd from the Microsoft Project Product team demonstrated syncing the Roadmap row item status with the task status from the Project Online schedule. This was done using compiled code in a console application which worked well. I set myself a little challenge to do something similar but all from Microsoft Flow. Being a public holiday here in the UK, I found an hour spare today to tackle this. In this blog post I walkthrough the Flow actions required to do this. A summary image can be seen below:

image

As you can see, this flow is triggered on a Project Online Project Publish. I then execute a REST query on the Project Data API using the send an HTTP request to SharePoint action:

image

I pass in the published project ID and select the TaskID and the custom field I’m using to set the Roadmap row item status. I created a custom field called “Roadmap Health” that was a lookup with the same status values as Roadmap but you can use any field and values, just update the query and Flow Switch action as needed.

I then create a new variable called “Health” and set the Type to an Integer:

image

I then add an Apply to each action and pass in the body(‘GetTaskHealth’)[‘value’] expression to use the output from my REST call:

image

I then have a condition check action to check for null values in the Roadmap Health field, the expression for the field is items(‘Apply_to_each’)[‘RoadmapHealth’] then null is also added via an expression:

image

You could remove the need for the condition check by filtering out the nulls in the REST call. If this is false, nothing happens as there is no status to sync, if this true the next action is a  Switch, the field I’m using in the switch is referenced using the expression: items(‘Apply_to_each’)[‘RoadmapHealth’]

image

Then for each possible value from the task level custom field you are using, map this to one of the Roadmap status’ by setting the Health variable, for example, when the Roadmap Health task field value is equal to “On Track” I set the variable to 0:

image

The Roadmap status enumerations are below:

  • On Track = 0
  • Potential Problem = 1
  • At Risk = 2
  • Complete = 10
  • Not Set = 100

Once that is completed for all possible outcomes, the next action is the List records Common Data Service action:

image

Here the Flow returns the Roadmap Item Link record for the TaskId passed in, the TaskId is referenced using the following expression: items(‘Apply_to_each’)[‘TaskId’]

The next action is another Apply to each action, Flow does this automatically as the List records would typically return more than one record:

image

The output used for this action is the default List records value from the Dynamic Content option. Then the final action within the Flow is the Common Data Service Update a record:

image

This action updates the Roadmap Items, I then pass in the List records Roadmap Item value from the Dynamic content panel, this is the Roadmap Item Id value. I also pass in the Health variable in the “Health Status Value” field. The flow will loop through all Project tasks and update the equivalent Roadmap row item status, pretty simple for a no / low code solution using only Microsoft Flow!

Over the next few days I will publish a short video for this Flow on my YouTube channel and also probably provide a download link for this Flow template to help as a solution starter.

#ProjectOnline custom #email notifications using #MSFlow #MicrosoftFlow #PPM #PMOT #MSProject #Exchange #Office365 #PowerPlatform Part 2

April 30, 2019 at 8:22 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Workflow | Comments Off on #ProjectOnline custom #email notifications using #MSFlow #MicrosoftFlow #PPM #PMOT #MSProject #Exchange #Office365 #PowerPlatform Part 2
Tags: , , , , , , , ,

Following on from my last post on email notifications using Microsoft Flow, this post looks at further examples. Part 1 can be found here: https://pwmather.wordpress.com/2019/03/18/projectonline-custom-email-notifications-using-msflow-microsoftflow-ppm-pmot-msproject-exchange-office365-powerplatform-part-1/

In case you missed it, I also published a video last week with a simple example Flow to send the project owner an email on project creation: https://youtu.be/CCdxUqBrhEA

In part 2 we will look another example email notification to email each resource the projects they are assigned to for the coming week. The Flow can be seen below:

image

This is triggered on schedule as seen below, update as needed:

image

The Flow then gets some date time values using the Date Time actions for the current date time and a future date time:

image

The Flow then fires off an HTTP request to SharePoint to get a list of resources with email addresses from the Project Online Odata Reporting API:

image

Then using an Apply to each action we send an email to the assigned resources. Firstly we pass in the output from the previous step, which is:

body(‘GetAllResourcesWithEmailAddresses’)[‘value’]

image

Then inside the loop we perform another HTTP call to SharePoint, this time to get the resource’s assignments for the week by querying the Project Online Odata Reporting API as seen below:

image

Here we are passing in 3 variables to the Odata query:

  • ResourceId which is the following expression added in: items(‘Apply_to_each’)[‘ResourceId’]
  • Current time and Future time to filter the data returned from the time phased resource demand endpoint to this week, these are the outputs from the previous date time actions:

image

The Flow then creates an HTML table from the data returned from the previous action:

body(‘GetAllResourceAssignments’)[‘value’]

image

Then the final action in the Flow is to send an email:

image

The To value is an expression: items(‘Apply_to_each’)[‘ResourceEmailAddress’]

Update the email body as needed and include the output from Create HTML table action.

This will result in an email being sent to all resources in Project Online with email addresses containing their weekly assignments detailing the projects that they are working on, here is an example email:

image

Another example that demonstrates how easily custom email notifications can be created for Project Online using Microsoft Flow.

#ProjectOnline custom #email notifications using #MSFlow #MicrosoftFlow #PPM #PMOT #MSProject #Exchange #Office365 #PowerPlatform Part 1

March 18, 2019 at 9:26 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Workflow | 1 Comment
Tags: , , , , , , , ,

This blogs post has been delayed due to all of my blog posts on Microsoft’s new Roadmap service – summary post here with most of the posts: https://pwmather.wordpress.com/2019/03/01/project-roadmap-cds-app-overview-ppm-projectmanagement-msproject-projectonline-office365-powerplatfom-dynamics365/

This post continues the series of posts I started to do in December 2018 following on from a Microsoft Tech Sync session where I presented a session on Project Online and Flow better together. As it’s been a while, here are links to the previous posts:

Post 1: https://pwmather.wordpress.com/2018/12/06/projectonline-publish-all-projects-using-msflow-microsoftflow-ppm-pmot-office365-powerplatform-part-1/

Post 2: https://pwmather.wordpress.com/2018/12/12/projectonline-publish-all-projects-using-msflow-microsoftflow-ppm-pmot-office365-powerplatform-part-2/

Post 3: https://pwmather.wordpress.com/2018/12/14/projectonline-snapshot-data-to-sharepoint-list-using-msflow-microsoftflow-ppm-pmot-office365-powerplatform/

In this post we take a look at an option for building custom email notifications with a no code / low code solutions using Microsoft Flow. This example sends an email for projects that are running late. There are two simple versions for this, one with a details table in the email and one with just the project name but includes hyperlinks in the email to the project detail page. These are both very similar, the first one can be seen below:

image

This is triggered on the Recurrence trigger, set based on your requirement. This then uses the Sent an HTTP request to SharePoint action to query the Project Online OData Reporting API:

image

This will control the data that is included in the email, so this OData query can be updated based on your requirements. Next the Flow uses the Create an HTML table action:

image

For this action we pass in the project data array from the previous action using a custom expression:

image

The final action is to send the email:

image

In the body of the email here we are just using the output from the previous Create HTML table action:

image

This results in an email being sent with the data from the OData query used (these are just my test projects and not real projects!):

image

Very simple! Sticking with the same theme for late projects but this time the email contains hyperlinks into the projects, this Flow is slightly different:

image

The difference here is we do not use the Create HTML table action but instead use Select and Join from the Data Operations actions. Firstly the select actions looks like this:

image

The Select action is used to transform the data in the results array from the previous step. Just the same as the Create HTML table in the first example, we pass in the project data array value from the previous action into the From property. Then the Select action was changed to use the text mode using the toggle option outlined in red below:

image

In Map properties, transform the data as needed in the email such as:

image

Here we are building up a URL passing in the ProjectId for the PDP URL (update to the correct PDP) and the ProjectName for the URL title. Then we use the Join Data Operations action to put each project on a new row in the email:

image

The From property is just using the Output from the previous Select action:

image

Then the final action is the email:

image

Note the Is HTML property is set to Yes. In the Body we type the email body as required plus the Output from the previous Join action:

image

Then the email is sent on the defined schedule with clickable links to the Project Detail Pages (again, these are just my test projects and not real live projects!):

image

These are two simple examples but as you can see, it’s very easy to build Project Online related emails using Microsoft Flow. I have some more examples in my next posts coming soon.

#ProjectOnline Snapshot / data to #SharePoint list using #MSFLow #MicrosoftFlow #PPM #PMOT #Office365 #PowerPlatform

December 14, 2018 at 10:00 pm | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information, Reporting, Workflow | 2 Comments
Tags: , , , , , , , ,

Next in my series of posts on using Microsoft Flow with Project Online is capturing Project Online data into a SharePoint list, this is a useful scenario for simple snapshot requirements. For example, if you want to snapshot some key project level data, the easiest place to store this data is in a SharePoint list. I have blogged simple code examples before that do this: https://pwmather.wordpress.com/2016/08/26/projectonline-data-capture-snapshot-capability-with-powershell-sharepoint-office365-ppm-bi/ & https://pwmather.wordpress.com/2018/01/27/projectonline-project-level-html-fields-to-a-sharepoint-list-powershell-ppm-office365/ Whilst these approaches work, the PowerShell does need to be run from somewhere, a server / Azure Function etc. This post provides the same end result with Project Online data in a SharePoint list but all from a Microsoft Flow. The Flow can be seen below:

image

This simple example makes use of the recurrence trigger to schedule the process, the “Send an HTTP Request to SharePoint” action to get the project data from Project Online and a SharePoint create item action inside an Apply to each loop. We will walkthrough the actions later in the post.

Firstly, the SharePoint list was created:

image

This was created in my Project Online Project Web App site collection. I created SharePoint columns on this list for each of the fields I wanted to capture from my Project Online dataset. As this is just an example, the number of fields and data is quite limited. Now back to the Flow. We will skip over the recurrence trigger to the first action that gets the Project Online data, this just uses the “Send an HTTP Request to SharePoint” action to call the Project Online OData REST API so that we can easily get all of the Project Online data. In this example we are accessing the Projects endpoint in this API and selecting a few example project level fields including an example custom field:

image

This action will get all of the data based on the Odata query used in the Uri input. We wont cover all of the settings here in this post as I covered this in the last post found here: https://pwmather.wordpress.com/2018/12/12/projectonline-publish-all-projects-using-msflow-microsoftflow-ppm-pmot-office365-powerplatform-part-2/

Next we need to loop through all of the projects in the results array to create a SharePoint list item for each project. To do this we need to use an “Apply to each” action:

image

In the output from the previous step we use body(‘ReadallProjects’)[‘value’] to use the data from the previous step which is all of our Project Online projects with some data minus the timesheet project in this example. Then for each project in the array we create a list item on our target SharePoint list using the create item action. In the create item action we just map the data from the array to the correct list column. The Project Online fields are accessed using an expression, for example for ProjectCost in this example Flow the expression is items(‘Apply_to_each’)[‘ProjectCost’] where apply to each is the name of the action and ProjectCost is the field / property in the results from the Odata query.

Once this Flow runs a few times you can then easily create snapshot / trend reports or even extend the SharePoint view to show what you need:

image

As you can see in this example, I’ve updated the SharePoint view to show the RAG icon in the Overall RAG column rather than the text value. This is very simple with the column formatting options available with the SharePoint modern UI using JSON.

Another example of extending Project Online with low / no code solutions in Office 365.

There will be further example solutions built for Project Online using Microsoft Flow in later posts.

#ProjectOnline Publish all projects using #MSFLow #MicrosoftFlow #PPM #PMOT #Office365 #PowerPlatform part 2

December 12, 2018 at 9:00 pm | Posted in Administration, Configuration, Customisation, Functionality, Information, Workflow | 4 Comments
Tags: , , , , , , ,

Following on from my first blog post on Publishing all projects in Project Online using Microsoft Flow, here is the 2nd post. For those that missed the 1st part, it can be found here: https://pwmather.wordpress.com/2018/12/06/projectonline-publish-all-projects-using-msflow-microsoftflow-ppm-pmot-office365-powerplatform-part-1/

In this post we will look at achieving the same publish all functionality but using different actions than we used in the last example. Previously we used the actions available with the Project Online connector, in this example we do not use the Project Online connector when accessing Project Online. The Project Online connector actions used previously to get the projects, check the projects out and then publish and check in the projects have been replaced with a SharePoint action where we can call the Project Online REST APIs. This is to show another example of working with Project Online using Flow. This approach does require an understanding of the Project Online REST APIs but this approach offers so much more capability for Project Online when using Microsoft Flow. The Flow can be seen below:

image

The difference between this Publish all flow and the example from part 1 is that we have replaced all of the Project Online connector native actions with the SharePoint “Send an HTTP Request to SharePoint” action and removed the Filter action as that is not required now. The “Send an HTTP Request to SharePoint” action can be used to work with the Project Online REST CSOM API and the Odata Reporting API directly from Microsoft Flow – this opens up so many more options for working with Project Online using Flow! This Flow assumes you have set up the connection for SharePoint Online using an account that has publish access to all projects and access to the Odata Reporting API in Project Online. This example is still triggered using the schedule action so I wont cover that part. Once triggered, the first action is to get all of the Project Online projects:

image

Enter the Project Online PWA site URL in the Site Address, select the HTTP Method – GET in this case. Then add the Uri, in this case we are using the Odata API to return all project Id’s and filter out the timesheet project but this could be updated to select only projects based on your logic such as projects with a certain custom field value or projects not published in a certain number of days / weeks etc. Then add the HTTP headers as seen. This action will get all of the projects based on the Odata query. Next we need to loop through all of the projects in the array to check them out, publish them then check them back in. To do this we need to use an “Apply to each” action:

image

In the output from the previous step we use body(‘Send_an_HTTP_request_to_SharePoint_-_get_projects’)[‘value’] to use the data from the previous step which is all of our Project Online projects minus the timesheet project in this example. Then for each project in the array we check out the project using another “Send an HTTP request to SharePoint” action:

image

This time the HTTP Method is a POST and the Uri is set to use the REST CSOM API to check out the project. We pass in the ProjectId from the current item in the array using items(‘Apply_to_each’)[‘ProjectId’]

The final action is to publish the project and check it in, this is done using another “Send an HTTP request to SharePoint” action:

image

The HTTP Method is a POST and the Uri is set to use the REST CSOM API to publish the project and check it in – the check in is performed using the true parameter. We pass in the ProjectId from the current item in the array using items(‘Apply_to_each’)[‘ProjectId’]

The final variation of this publish all example is only very slightly different, the only difference is that it is manually triggered rather than on a schedule. We have removed the schedule action and replaced it with a SharePoint trigger to trigger when an item is created on a list:

image

I have a list on my PWA site that only PWA admins can access, here an admin user creates a new item, this then triggers the publish all flow:

image

We then have a history of who triggered the publish all jobs and when.

This post will hopefully give you some ideas on how Microsoft Flow can now really compliment Project Online and offer some scenarios for low / no code customisations.

In the next post we will look at more examples for building low / no code solutions for Project Online using Microsoft Flow.

Blog at WordPress.com.
Entries and comments feeds.