Home > Paul Mather, Work > Access #ProjectOnline #Project sites using #PowerShell and #SharePoint CSOM #Office365

Access #ProjectOnline #Project sites using #PowerShell and #SharePoint CSOM #Office365

Paul Mather
I am a Project Server and SharePoint consultant but my main focus currently is around Project Server.
I have been working with Project Server for nearly five years since 2007 for a Microsoft Gold Certified Partner in the UK, I have also been awared with the Microsoft Community Contributor Award 2011.
I am also a certified Prince2 Practitioner.

This article has been cross posted from pwmather.wordpress.com (original article)

This PowerShell script will use the Project Reporting OData API to get a list of all the Project Sites in the PWA Site Collection linked to a project. It will then access each of those project sites to enable you to easily update / review the site if needed. This example just lists all of the list titles for each site but can be used as a starting script for modifying a particular list or adding a new list on all project sites etc. This could be used to help rollout changes to existing Project Sites, the code here will help you get connected and access each Project Site object using CSOM. You could even use this example to get the project site URLs then use the approach I blogged about the other month with the PnP PowerShell to month the sites. The example is for Project Online but could easily be updated for Project Server 2013 / 2016.

The user running the script will need to update the source PWA instance URL, username and password. The account will need access to the OData API in PWA and access to all of the project sites.

This script example can be downloaded here: http://bit.ly/29tPnA9

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.

The good thing about using the OData API to return the list of Project Site URLs is that if you have certain sites for each Enterprise Project Type you could easily filter the OData query to only return the project site URLs for the correct Enterprise Project Type.

Once 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), firstly this example will give you a count of project sites:


Then for each of those sites it will list all of the SharePoint lists on each site:


As mentioned, this just lists all of the lists so probably isn’t that useful unless you wanted to check each Project Site had the correct lists. The script could be modified to update those project sites or lists fairly easily depending on what the changes were. All I would say is that if you are looking to update / make changes to the project sites, fully test your modified script on a non-production PWA instance first as you could cause a lot of damage if you weren’t careful!

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

Categories: Paul Mather, Work Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: