#ProjectOnline / #ProjectServer #Project site provisioning using #Office365 PnP remote provisioning #SharePoint #PowerShell

May 4, 2016 at 4:20 pm | Posted in .Net, Add-on, Administration, App, Configuration, Customisation, Functionality, Information, Installation | 1 Comment
Tags: , , , , , ,

For many years now Project Server deployments have used Project Sites or known as Project Workspaces before Project Server 2010. Typically most deployments have custom requirements for the sites so custom site templates were created from a site created using the default Project Site template. The updated custom site template was then linked to the Enterprise Project Type so that new projects created used the new site template. The biggest issue with this approach was that if you wanted to update the site template later on down the line all of the existing project sites would either need manually updating or writing code to traverse through all the existing sites and make the changes. With the new online world in Office 365 there are other things to think about too. If you create a new custom site template based on the default Project Site template then Microsoft roll out a new feature in the base Project Site template – your new project sites wont get that change either. This is where the PnP remote provisioning engine is great. For a while now – at least a year or 2 I think, the best practise is to stick with the default site templates Microsoft provide, so the Project Site template for example. The Enterprise Project Types should use the default Project Site template so each new project gets a site created using the default site template. But what about my custom lists, or columns or views I hear you ask – deploy the custom artefacts once the site is created from the default site template. In this post I will give you a very quick introduction to the Office 355 PnP Remote Provisioning engine which is part of the PnP core component. PnP, known as Patterns and Practices – details can be seen here: http://dev.office.com/patterns-and-practices. This will enable you to deploy your custom site artefacts.

For this example we will look at the PowerShell variant: https://github.com/OfficeDev/PnP-PowerShell but is also available with managed code. To get started with the PowerShell version follow the steps in the GitHub link to get the components installed. I have created a project / project site using the default Project Site template and added a new list called Change Requests that is linked to a Site Collection Content type in my root PWA site collection:

image

This list has two views:

image

I have also updated the default Risks list to use custom content type and included one new column:

image

I have added my new column to the All Items view:

image

This is the new site template I want to use. Typically this is where you would save as a template but not for this example.

Once the PnP components are installed on your machine, connect to the source project site using this command – update the Url for your site:

Connect-SPOnline –Url <source site URL> 

image

Enter credentials if prompted to do so.

Now use the following command to extract the site:

Get-SPOProvisioningTemplate -Out C:\Temp\PnP\NewTemplate.xml

image

This process will extract the site definition and create an XML file in the specified location:

image

At this point the XML should be modified to remove unneeded properties. For example, as this project site is linked to a project already the property bag will contain certain properties referenced to the source site – I don’t want to overwrite these settings on my target sites so I removed the property bag entries highlighted below.

image

I have also removed properties for configuration I don’t need to update, other lists etc.  See an example below, I have only left the two lists I have added / updated:

image

I don’t cover this here but I used Visual Studio – really one for the devs out there.

Once you are happy with the source XML file you are ready to deploy this to the existing project site/s. In this example I have a test project site created by the default Project Site template that has not been modified:

image

In PowerShell I now connect to the test target site using the command below – update the Url for your site:

Connect-SPOnline –Url <target site URL> 

image

Then run the following command to apply the changes:

Apply-SPOProvisioningTemplate -Path C:\Temp\PnP\NewTemplate.xml

image

Once completed the test target site should be updated, in this example, with a new list and updated risk list. Once you are happy with the test target project site you could repeat the process on other project sites. I have found some settings are not set correctly and some do generate errors in PowerShell but there are usually monthly updates the PnP code so always ensure you regularly update the modules using the Update-Module command.

This is a very simple example using PowerShell, in production you might have a full script that has a list of Project Sites you want to update and get the script to update them all etc. Or better still, go down the manage code route and create an event driven SharePoint provider hosted add-in to do it. Either way, fully test this process on test project sites / projects first before any production projects / project sites!

Advertisements

1 Comment »

RSS feed for comments on this post. TrackBack URI

  1. […] 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 / […]


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: