#ProjectOnline project user sync to project sites #PPM #O365 #PowerShell #SharePoint

July 7, 2017 at 4:13 pm | Posted in Add-on, Administration, App, Customisation, Functionality, Information, PowerShell, Workarounds | Leave a comment
Tags: , , , ,

This is a supporting blog post for an example solution starter PowerShell script I wrote for Microsoft’s Office 365 PPM tool Project Online. With the great improvement from Microsoft to now support up to 30,000 Projects and Project Sites in one Project Online Project Web App site collection, there are some limitations such as not being able to sync the users to project sites outside of the PWA site collection. For details on this change see the post here:

https://pwmather.wordpress.com/2017/06/14/projectonline-project-site-settings-location-sharepoint-ppm-o365-msproject/

This solution starter script just demonstrates one method to sync the project team members into the associated Project Site-  the concept would also be useful when using the SharePoint permission mode in PWA. The example script is fixed to one example project / project site and only adds the team members to the members SharePoint group on that site. It doesn’t loop through all projects  or remove users from the project sites etc. This could all easily be done but is beyond the scope of the code sample / solution starter.

The code sample / solution starter can be downloaded from here: https://gallery.technet.microsoft.com/Online-User-Sync-to-7a75ef77

To get the script to work, there will need to be some environment variables set and a DLL available, these are detailed below.

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

image

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.

You will then need to update the environment detail placeholders as seen below:

image

Add the Full PWA URL, username and password for an account that is a full admin on the PWA site collection. Select an example project to test with on a non-production PWA project / project site. Use a project that is not syncing the users to the project site automatically – for example a project site outside of the PWA site collection. Copy the Project GUID – it will be similar to this: 4b75dfb8-4051-e711-80c9-00155da85037 and update the script with the project GUID. An easy way to get the Project GUID is from the PWA PDP URL when accessing the project. For the same project, copy the full project site URL and update the script then find the name of the correct SharePoint group to add the users to. For example it could be the members group. The groups can be found from the project site > Settings cog > Site Settings > Site Permissions.

Once these variable placeholders are set, save the script. Run the script using PowerShell and you will see the users added to the specified group on the project site. Fully test this on a non-production PWA instance first. The code should really be updated to production standard code before using on a production PWA instance and handle removing users, adding users to different permissions groups based on role and dynamically getting the projects and project site urls etc.

Below you can see the output from the PowerShell ISE when running against my example project  / project site on my test PWA instance:

image

Looking at the project site you can see the users here:

image

A production version of the PowerShell script could be set to run each day / night etc. as required. The code could also easily be run using an Azure Function and executed from a URL – you could then build is an event driven type user sync – more on that in my next blog post.

The script is provided "As is" with no warranties etc. – this is just a free solution starter so is use at your own risk.

Advertisements

Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: