#ProjectOnline data capture / snapshot capability with #PowerShell #SharePoint #Office365 #PPM #BI

This blog post will show an option to capture Microsoft’s PPM Project Online data into a SharePoint list on a schedule to enable time driven data capture for snapshot / trend reporting capability. This example makes use of a PowerShell script I created to get the data and write this to a SharePoint list. The PowerShell script will use the Project Reporting OData API to get all of the specified project data in the PWA Site Collection then create a list item on the specified SharePoint list. The user setting up the script will need to update the source PWA instance URL, username, password and list name. The account specified will need access to the OData API in PWA and contribute access to the target SharePoint list. The SharePoint list will also need to be created beforehand with the required columns. The OData query will need to be updated to include the correct project level fields required and the part of the script that creates the list items will need to be updated too. This is covered below.

This script example can be downloaded here: https://gallery.technet.microsoft.com/Online-Snapshot-example-0437b680

To get the script to work you will need to reference the DLL as seen in the image below:


This can be installed from the SharePoint Online Client components / management shell. I used the dll from the SharePoint Online Management Shell in this example.

Please note, this has only been tested in PowerShell 3.0 and might not work in other versions. If you have any issues try this in PowerShell 3.0.

Firstly decide what project level fields you want to capture, this will determine the list column requirements. Then create the SharePoint list in the PWA site collection with the required columns, for this example I created a list called ProjectSnapShots with the columns below:


The SnapshotDate column was set to have today as the default value so that when the items are created the date is set automatically.

Update the Project OData query to include the correct fields that you want to capture, in this simple example I have included the following:


$url = $PWAInstanceURL + "/_api/ProjectData/Projects()?`$Filter=ProjectType ne 7&`$Select=ProjectId,ProjectName,ProjectPercentCompleted,ProjectHealth,ROI,RiskRating&`$orderby=ProjectName"

As you can see I have a list column for each project level field. The next part of the script that needs to be updated is the item creation:


This is where you map the project level fields to the correct SharePoint list columns based on the data you are capturing.

Also ensure the variables have been updated correctly, placeholder values seen below:


Save and run the PowerShell script (fully test on a non-production PWA site collection before Production) to ensure the data is captured correctly in the target SharePoint list. You could then set this up to run as a scheduled task on a local server or a scheduled WebJob in Azure to capture the data weekly or monthly etc. For details on a scheduled WebJob see: https://azure.microsoft.com/en-gb/documentation/articles/web-sites-create-web-jobs/

Once the script is run you will see the data in the SharePoint list, below I have run this 3 times:


You could then create a snapshot / trend report as required from the list data and even join to the live Project OData API if you capture the Project ID as I have in the example script / list.

A simple time driven data capture to enable snapshot / trending reports for Project Online. This script could easily be modified to capture the data into a SQL database, either on-prem or in Azure SQL if required. Also if this was to be run in production the script should be updated for error handling with try / catch blocks etc.

The script is provided "As is" with no warranties etc.


5 thoughts on “#ProjectOnline data capture / snapshot capability with #PowerShell #SharePoint #Office365 #PPM #BI

  1. Hi and thanks for this. However, I set a simple 3 field example list and I get exceptions stating the field doesn’t exist in the list (but it does).

    This is the edited bottom portion of your script:

    #get the target list
    $List = $ctx.Web.Lists.GetByTitle($listname)

    #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[“PercentCompleted”] = $projectrow.ProjectPercentCompleted
    $newitem[“BusinessObjective”] = $projectrow.BusinessObjective

    The columns are definitely there on a list that is located on the PWA site at:

    These are the errors I get when running it:

    Exception calling “ExecuteQuery” with “0” argument(s): “Column ‘PercentCompleted’ does not exist. It may have been
    deleted by another user. /sites/pwa/Lists/ProjectData”
    At C:\test\snapshotPMPi.ps1:60 char:4
    + $ctx.ExecuteQuery()
    + ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ServerException

    I see this as a really cool tool and would love to get it working. Can you help?

    Thank you so much. David.

    1. Just a note in case anyone reads this – I figured out what was wrong. It seems if you create the list columns and then rename them, you still have to have the ‘internal’ column name (the original one) in this script.

Comments are closed.

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: