#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 | Leave a comment
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.

Advertisements

#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 | 1 Comment
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.

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

December 6, 2018 at 12:00 am | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information, Performance, Reporting, Workflow | 1 Comment
Tags: , , , , ,

I recently had the opportunity to present at a Microsoft Tech Sync session where I presented a session on Project Online and Flow. During this session gave examples of how Microsoft Flow compliments Project Online by enabling no / low code solutions to extend the Project Online features. I plan to do several blog posts over the next month or so where I will share some of these Microsoft Flows. Hopefully this will give you some ideas of how Microsoft Flow can be used to simplify some of those customisations for Project Online.

The first Flow example I want to share with you is a publish all projects flow. I have published examples before for Project Server and Project Online as found here:

These all required a basic understanding of the Project Server / Project Online APIs and somewhere to run the code from – I thought this would be a good example to move over to a Microsoft Flow. In this blog post I will walkthrough the first example I have for publishing all projects as seen here:

image

This is built using only actions from the Project Online connector in Flow – so there is no need to understand the Project Online APIs! This Flow assumes you have setup the connection to Project Online using an account that has publish access to all projects. This Flow is triggered using a schedule as seen here:

image

When this Flow is triggered, the first action is to get all the Project Online projects using the List Projects action:

image

All you need to do is provide the PWA site URL. This List Projects action also includes project templates so these need to be filtered out, to do this we filter the results returned from the List Projects action using a Filter Array action:

image

In the From field we enter body(‘List_projects’)[‘value’] to get the data from the previous action, which in this case is the List projects action. In the filter we use item()[‘ProjectType’] is not equal to 1, Project Type 1 being the Project Templates. In advanced edit mode it looks like this:

image

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(‘Filter_array’) to use the data from the previous step which is all of our Project Online projects minus the project templates. Then for each project in the array we check out the project using the default Checkout project action:

image

Enter the Project Online PWA URL then in the Project Id property pass in the Project ID from the current item in the array using items(‘Apply_to_each’)[‘Id’]

The final action is to publish the project and check it in, this is done using the default Checkin and publish project action:

image

Enter the Project Online PWA URL then in the Project Id property pass in the Project ID from the current item in the array using items(‘Apply_to_each’)[‘Id’]

That is it, when this flow executes it will publish all of your Project Online projects. A simple no code serverless solution!

In part 2 we will look at two other variations for publishing all projects in Office 365 Project Online using Microsoft Flow.

#MicrosoftForms and #MicrosoftFlow for #ProjectOnline #PPM project reviews #O365 #SharePoint #PMOT

February 11, 2018 at 10:47 pm | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information | Comments Off on #MicrosoftForms and #MicrosoftFlow for #ProjectOnline #PPM project reviews #O365 #SharePoint #PMOT
Tags: , , , ,

Most projects at some point have some kind of review such as a stakeholder review or project closure review. As Project Online is built on SharePoint there are many ways that this can be achieved but in this blog post we will look at making use of Microsoft Forms to design those reviews, Microsoft Flow to capture the responses for the reviews and SharePoint Online to store the data in a list in the Project Web App site collection. As Project Online is built in the Microsoft Office 365 cloud there are lots of great features that you can make use of, Forms seemed a good fit for a project review.

Firstly access https://forms.office.com/ to get started with your review form. Please note Forms is currently in Preview. Click the New Form button:

image

This will load the form designer:

image

You can use the Theme button to select a theme or upload your own:

image

Enter a form title and description:

image

Then click the Add question button:

image

Select the type of response your question requires, notice the two additional options on the ellipsis at the end. Depending on the type of question selected, that will determine the control used on the form. Design the form as required, for this blog post, here is my very simple form:

image 

Now on my Project Online PWA site in SharePoint Online I have created a list that contains columns for each of my questions:

image

The next step is to access Microsoft Flow and click create from template:

image

This blog post assumes you have already set up the connection to your SharePoint Online tenant in Microsoft Flow.

Search for forms and the existing templates for Forms will be loaded:

image

For this example we just need the first one “Record form responses in SharePoint”, click Continue:

SNAGHTMLfdf7de8

Give the Flow a name then select the correct form in the “When a new response is submitted” Flow action:

image

Then again in the “Get response details” Flow action:

image

Then select / type / paste the SharePoint site URL and select the list created in the “Create item” Flow action:

SNAGHTMLfe28386

Then map the responses from the form to the SharePoint list columns in the “Create item” Flow action:

SNAGHTMLfecca34

Save the Flow.

Now back in Forms, access the Form then click the ellipsis then Settings:

image

On the form settings, set who can respond to the form, in this example I only want people in my organisation to response and I set it to record their name:

image

Now click the Share button to get the form URL to send to the relevant users or add in the Project Web App site. For example, if you were creating a project closure review form or stakeholder review form you might add this to a certain Project Detail Page that is only visible at a certain stage of the project lifecycle.

Once users respond you will see the flow runs in the run history and you will also see the responses on the target SharePoint list. See some example responses below:

image 

Do be aware of the SharePoint list access – you might want to restrict access to this list!

Running #ProjectOnline #PowerShell in #Azure using #AzureFunctions #PPM #Cloud #Flow #LogicApp Part2

August 1, 2017 at 4:32 pm | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information, PowerShell, Workflow | Comments Off on Running #ProjectOnline #PowerShell in #Azure using #AzureFunctions #PPM #Cloud #Flow #LogicApp Part2
Tags: , , , , , , ,

Following on from part 1 where I introduced the idea of automating certain Microsoft 365 PPM Project Online customisations using PowerShell, Microsoft Flow / Azure Logic Apps and Azure Functions, in part 2 I will set up an example automation for creating a Project Online event driven snapshot application on project published without having to set up any server or write any complied code! If you missed part 1 where this concept was introduced, see the link below:

https://pwmather.wordpress.com/2017/07/28/running-projectonline-powershell-in-azure-using-azurefunctions-ppm-cloud-flow-logicapp-part1/

Firstly I created an Azure Function app in my Azure subscription then created a new function based on the HttpTrigger – PowerShell template:

image

Give the function a name and set the Authorisation level – set the authorisation level to the correct setting for your function. Click Create. For details on Azure Functions, start here: https://docs.microsoft.com/en-us/azure/azure-functions/

You will then be presented with the function and sample code:

image

We will now create the PowerShell script to create the snapshot. This is based on a script I published a while back: https://pwmather.wordpress.com/2016/08/26/projectonline-data-capture-snapshot-capability-with-powershell-sharepoint-office365-ppm-bi/

The script has been updated to work in an Azure Function but also modified to use a parameter so that it only captures data for the published project, the PowerShell script can be seen further on in the post.

Firstly upload the SharePoint CSOM DLLs using the upload button:

image

I used the SharePoint CSOM DLLs from the SharePoint Online Management Shell:

image

Then enter the PowerShell code – screen shots below and code pasted below the images:

image

image

image

Code sample used in function:

# POST method: $req
$requestBody = Get-Content $req -Raw | ConvertFrom-Json
$projID = $requestBody.projID

# GET method: each querystring parameter is its own variable
if ($req_query_name) 
{
    $projID = $req_query_name 
}

#add SharePoint Online DLL - update the location if required
Import-Module "D:\home\site\wwwroot\ProjectSiteUserSyncHTTPTrigger\Microsoft.SharePoint.Client.dll"
Import-Module "D:\home\site\wwwroot\ProjectSiteUserSyncHTTPTrigger\Microsoft.SharePoint.Client.Runtime.dll"

#set the environment details
$PWAInstanceURL = "https://mod497254.sharepoint.com/sites/PWA2"
$username = "admin@MOD497254.onmicrosoft.com" 
$password = "password"
$securePass = ConvertTo-SecureString $password -AsPlainText -Force
#create the SharePoint list on the PWA site and add the correct columns based on the data required
$listname = "ProjectSnapShots"
$results1 = @()

#set the Odata URL with the correct project fields needed
$url = $PWAInstanceURL + "/_api/ProjectData/Projects()?`$Filter=ProjectId eq GUID'$projID'&`$Select=ProjectId,ProjectName,ProjectPercentCompleted"

#get all of the data from the OData URL
while ($url){
    [Microsoft.SharePoint.Client.SharePointOnlineCredentials]$spocreds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePass);    
    $webrequest = [System.Net.WebRequest]::Create($url)
    $webrequest.Credentials = $spocreds
    $webrequest.Accept = "application/json;odata=verbose"
    $webrequest.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
    $response = $webrequest.GetResponse()
    $reader = New-Object System.IO.StreamReader $response.GetResponseStream()
    $data = $reader.ReadToEnd()
    $results = ConvertFrom-Json -InputObject $data
    $results1 += $results.d.results
        if ($results.d.__next){
        $url=$results.d.__next.ToString()
    }
    else {
        $url=$null
    }
}

#add data to snapshot list
#get PWA site client context
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($PWAInstanceURL) 
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePass) 
$ctx.Credentials = $credentials 
$ctx.ExecuteQuery()  
 
#get the target list 
$List = $ctx.Web.Lists.GetByTitle($listname) 
$ctx.Load($List) 
$ctx.ExecuteQuery() 

#for each project, create the list item - update the newitem with the correct list columns and project data
foreach ($projectrow in $results1) 
{ 
   $itemcreationInfo = New-Object Microsoft.SharePoint.Client.ListItemCreationInformation 
   $newitem = $List.AddItem($itemcreationInfo) 
   $newitem["Title"] = $projectrow.ProjectName
   $newitem["ProjectId"] = $projectrow.ProjectId
   $newitem["PercentCompleted"] = $projectrow.ProjectPercentCompleted
   $newitem.Update() 
   $ctx.ExecuteQuery() 
} 

The PowerShell code would need to be updated with your environment details: (PWAInstanceUrl, username, password and listname variables). Also the OData URL will need to be updated to include the project level fields that you want to snapshot.The target SharePoint list will also need to be set up in the PWA site collection for the project fields the script uses. This is the list I set up for this example:

image

SnapshotDate is set to Todays date so we don’t need to set that in the code.

The code is simple to follow but in summary the first part will get the projID from request body – we will pass in the ProjectID for the published project from the Flow / Logic App trigger. Then the SharePoint Online CSOM DLLs are imported in. Then the specific PWA environment details are set for the variables. The OData URL is then added to the url variable. Here notice we are filtering for the ProjectID and passing in the $projID variable we get from the request body. The Select part of the query will need to be updated for your project level fields. Next the code gets the data from the OData feed using the web request and adds the data into the results array. Once we have the data, we connect to the SharePoint list, in the example it is the ProjectSnapShots as set in the $listname variable. Lastly the new item is created in the list using the data from the results array.

Now the Azure Function is ready to be used. It can be tested using the Test option in the right hand panel, update the Request body:

image

Update it for a valid project ID. Then click Run above the function code:

image

The Logs window below will help you debug any errors etc.:

image

Then check the SharePoint list in the PWA site and the new item should have been created:

image

We now know the Azure Function is working as expected, now we need to call the Azure function when a project is published. All we need from the Azure Function is the URL to use, use the </>Get function URL button:

image

Select the correct Key, in this example I used the default function key. Copy the URL as it will be needed later.

To call the Azure Function when a project is published, the choice here for a no code option would be Microsoft Flow or Azure Logic App. For this I will use Microsoft Flow but the same steps (triggers , actions etc.) would be used in the Azure Logic App. Create a new Flow and search for Project Online:

image

Then select the Project Online – When a project is published trigger.

Enter the PWA URL:

image

Then click the ellipsis and set the connection for the PWA URL or create a new connection if needed:

image

Click + New step then Add an Action and search Http:

image

Select HTTP – HTTP:

image

Complete the HTTP action:

Method is POST, the Uri is the URL for the function that we copied earlier, Headers are not required. The Body is where we pass in the project ID from the published project trigger:

image

The Flow is now completed:

SNAGHTML55ecdca7

Now click Save flow.

In PWA, Publish a project or projects and see the snapshot data created on the configured snapshot list once the Flow has run:

Flow run:

image

Data added to the list for the project I published – in this example it was the Office 2016 rollout project:

image

This just shows a simple example and the some of the possibilities for extending the Project Online capability when making use of simple PowerShell scripts and other Microsoft 365 / Azure services for cloud / serverless solutions. Look out for more examples in the future.

Running #ProjectOnline #PowerShell in #Azure using #AzureFunctions #PPM #Cloud #Flow #LogicApp Part1

July 28, 2017 at 4:50 pm | Posted in Add-on, Administration, App, Configuration, Customisation, Fixes, Functionality, Information, PowerShell, Workflow | 4 Comments
Tags: , , , , , ,

Following on from my last post where I published an example solution starter PowerShell script for adding project team users to the Project Site, here I mentioned about running the script in an Azure Function and even running this sync from a Project Online event. The blog post can be seen below if you missed that:

https://pwmather.wordpress.com/2017/07/07/projectonline-project-user-sync-to-project-sites-ppm-o365-powershell-sharepoint/

Whilst I will use that example PowerShell script from my last blog post as an example, the concept will work for any PowerShell script.

I wont cover the details in setting up the Azure Function in part 1 as there is plenty of support out there for this – for this example I created an Http Trigger – PowerShell function.

image

I then uploaded the SharePoint DLLs and copied in the PowerShell script into the editor:

image

The project site user sync script didn’t work as is as I had to make some minor changes to get this to run from the Azure Function. This included change the way the SharePoint CSOM DLLs where loaded in. In the example script I used Add-Type to load the DLLs but in the Azure Function I had to switch this out to use Import-Module:

image

The next change I had to make was to comment out all of the feedback to the console, so all of the write-hosts. I also had to remove the functions within the script so that is was one block. After these changes I could execute the PowerShell script to add the project team members from my example project into the associated project site from the Azure Function. As this was an HTTP Trigger Azure Function, you can get the URL to the function and access that URL to execute the function.

This opens up lots of possibilities to easily execute this Azure Function from other applications that can make the HTTP call. For example you build easily execute this script once the project has been published either using a remote event receiver (RER) or a Microsoft Flow / Azure Logic App. The example script would need to be made generic and pass in a variable into the Azure Function for it to be a workable solution.

In part 2 of this blog post we will look at make a full event driven solution that is fired on project publish then executing the Azure Function and passing in a variable.

Introduction to #Microsoft Flow with #ProjectOnline #IFTTT #WebHooks #OfficeDev #Yammer #Office365

May 6, 2016 at 12:11 pm | Posted in Add-on, Administration, Configuration, Customisation, Functionality, Information, Workflow | Comments Off on Introduction to #Microsoft Flow with #ProjectOnline #IFTTT #WebHooks #OfficeDev #Yammer #Office365
Tags: , , ,

At the end of April Microsoft’s Flow was made available as preview. Microsoft Flow is an If This Then That (IFTTT) service with many built in web hooks or connections to different services. You can connect to services like SharePoint Online, CRM or Twitter to name a few. A blog post from Microsoft can be found here.

In this post we will see an example of using Microsoft’s Flow service with Project Online – Microsoft’s Office 365 PPM application. When a project is created we will post a message in Yammer. Once signed in, click on My Flows from the top navigation bar:

image

From here you can view preconfigured templates or create from blank. Currently there aren’t any templates for Project Online so click create from blank. On this page you will see all of the services you can work with currently in the preview version:

image

Either start typing Project or scroll down the list to Project:

image

For this example I will choose “Project Online – When a new project is created”. You then need to sign into the Project Online PWA site:

image

Enter your credentials for the target Office 365 tenant when requested. Then enter the URL of the PWA site:

image

Now click the + button to either add an action or add a condition:

image

For this example we will just add an action without any conditions. You can add conditions in if needed though like below, if the project name contains “delivery” do something:

image

Also notice the advance mode where you can type the query condition:

image

For this demo we don’t need any conditions so I will remove that and just add an action and search Yammer:

image

Then select “Yammer – Post message” and click the sign in link then follow the steps to allow the access:

image

It’s your call to allow the access or not for services for this demo I have but only do this if you accept the terms of service. Then you can complete the details for the Yammer post:

image

This is what I have done:

image

Then give the Flow a name:

image

Click Create Flow and after a few seconds you will see the message stating this was created:

image

Click Done and the wizard is complete:

image

You can edit / delete the Flow from the My Flows page:

image

Now if I create a Project in that Project Online instance a new post will be created in the Yammer group. There maybe a minute or so delay before you see the post in the Yammer group once you create the project but here it is:

The project – “Paul Mathers test project”:

image

In Yammer, the post including the project name:

image

Notice the post if from Microsoft PowerApps.

You can check the Flow runs from the My Flow pages, click the i button at the end:

image

You will then see the following:

image

This is just a simple example – there is so much you can do even in the preview version of Flow – I’m sure more and more web hooks and functionality will be added before this is GA. Take a look today, it is very easy to use as you can see.

Blog at WordPress.com.
Entries and comments feeds.