For almost two years now, a group from the Microsoft Patterns and Practices division, led by Vesa Juvonen, started the Office 365 Dev PnP program with the aim of helping clients transition and adopt SharePoint Full Trust solutions, Add-ins model, and to establish guidelines and best practices for a successful transition.

PnP program components

Office 365 Dev PnP was released in GitHub, and soon after it was split into several repositories. These are some of the core components:

PnP Sites Core:

This is the core PnP component. It consists of a library with different classes and methods that will make our lives easier when working with the SharePoint client-side object model (CSOM). In addition, it includes the Provisioning framework that we will discuss later on.


PnP Provisioning Schema:

This project has the XML Schema used by the Provisioning framework. This XML will reminds us of the previous XML used in the “old-style” SharePoint solutions. It consists of most of the components of a SharePoint solution, such as Fields, ContentTypes, Lists, Files, Pages, RegionalSettings, etc.


PnP PowerShell:

Power-Shell Command enables more useful methods.



This was the source repository that later was split into several repositories, among those mentioned above. This repository currently contains several samples of PnP use and other best practices.


Interesting samples

The following list contains some of the most interesting examples that we can find in PnP, we advise to view all of the examples.


Branding Apply Branding:

This shows best practices when applying branding and other publishing features.


Core Create Content Types:

It allows to create Content Types using PnP Core.


Core Embed JavaScript:

Good practice when injecting JavaScript and updating User Interface.


Core MMSSync:

Syncronization of Metadata TermStore through multiple TermStores.


Provisioning Cloud Async Webjob:

Creation of Site Collections from a WebJob in Azure.


UserProfile Manipulation CSOM Console:

User Profiles update through Client Object Model (CSOM).


Extensions and useful methods with CSOM

Some of the classes and methods that extend CSOM:


Client Context Extensions Execute Query Retry:

Similar to the ExecuteQuery () method, but it manages possible connection errors and applies several retries (10 by default, with a delay of 500 ms).

Field and Content Type Extensions: 

Class with several extensions to work with Fields and Content Types.

List Extensions: 

Extensions to work with Lists (create Lists, Views, get lists, etc.).

Taxonomy Extensions: 

Extensions to work with Managed Metadata Fields (create MMD fields, create Terms, create Groups, etc).


Provisioning Framework

This is probably the star of PnP. This framework is intended to replace the old model of deployment for SharePoint solutions based on WSP solutions, and making it based on a remote model, using CSOM, and an XML scheme for defining of Columns, Lists, Pages, etc. As mentioned above, the XML scheme is defined in the project PnP-Provisioning-Schema and these are the core nodes:

The definition of a Template consists of:

The complete definition of the scheme can be found in:

Not all of the Scheme nodes are supported by the Provisioning framework. For example, the Sequence Node allows to define SiteCollections and Sites within it, so it will be logical to assume that the framework allows to create Site Collections and Sites, however, this is something that is not supported (yet) by the framework.


There is a complex but complete example of XML in:


And the following C# code will provide the XML in an existing site:


XMLFileSystemTemplateProvider provider = new XMLFileSystemTemplateProvider(@"c:\temp\pnpprovisioningdemo", ""); string templateName = "template.xml"; ctx.Web.ApplyProvisioningTemplate(template);

A great benefit is that the framework also allows to create XML from an existing site (not everything is exported, for example, all the existing pages are not exported). For exporting a site and save the XML generated, we can use the following code:

XMLFileSystemTemplateProvider provider = new XMLFileSystemTemplateProvider(@"c:\temp\pnpprovisioningdemo", ""); string templateName = "template.xml"; provider.SaveAs(template, templateName);


We can also export a site as a Template, or apply an XML template from PowerShell, with the commands:


Apply SPO Provisioning Template



Follow-up of the PnP program

Besides the GitHub projects, the PnP team continuously release very interesting information about the development for Office 365:

Yammer Network: 

This is probably the best way of keeping up to date about PnP. In addition, you can submit any questions and comments and receive support from the PnP team themselves.

PnP Channel in Channel 9: 

Videos with demos and examples of use of PnP

PnP Blog:

Monthly community call of PnP: 

Write this date down in your calendar. Every month the PnP team holds a meeting at which they inform one another about the program’s state and roadmap, as well as demonstrate examples, etc. It was a pleasure to be able to catch up with the PnP team and receive updates from Vesa himself.

Author bio

Luis Mañez
Luis Mañez
Atlas Chief Architect & Microsoft MVP
I help find the best technical designs to meet client needs and act as tech lead to build great solutions. I have fun with some R&D tasks, always trying to improve our tools and processes, and I often help the Microsoft community as a blogger and speaker, contributing to open source projects.


comments powered by Disqus

Related Articles

Sign up to our ClearThought newsletter

Get inspired and learn something new by subscribing to our FREE newsletter. It’s full of ClearPeople's thought-leadership whitepapers, blogs, events, and much more. We promise to not use your email for spam.

Closing this message and/or accessing our website tells us you are happy to receive all cookies on the ClearPeople website.
However, if you would like to, you can change your cookies settings at any time.