PnP Provisioning framework

Posted 14 May 2016 12:00 AM by Luis Manez, SharePoint & Cloud Solution Architect @ ClearPeople

An important announcement that is not in the article, but that Vesa Juvonen announced during the bi-weekly team Webcast, is that the PnP program will become part of the SharePoint product group, which means that the program is still Open Source and made by and for the community but, in some way, Microsoft recognises the success and good work of the program, and, in my opinion, the product team will begin to use it internally.

Related to this announcement, another item of this May release, is the changes at nuget package level, where we now have 3 packages oriented to each one of the different environments, including a specific version for the new SharePoint 2016:

  • SharePoint PnP Core library for SharePoint Online
    • Install-Package SharePointPnPCoreOnline
  • SharePoint PnP Core library for SharePoint 2013
    • Install-Package SharePointPnPCore2013
  • SharePoint PnP Core library for SharePoint 2016
    • Install-Package SharePointPnPCore2016

Currently the previous packages are still available, which have been also updated with the changes in May. However, note that they are already marked as [Deprecated], therefore they will be removed soon.


PnP program components

Lastly, before talking about the Provisioning Framework architecture, let’s remember some of the most renowned PnP components, in this case using a graph, as you can see in the following image:


Provisioning Framework Architecture

We are going to analyse in detail how the Provisioning Framework works and which is its architecture. In this case we are going to talk about the operation of importing a defined template in an XML file, to a SharePoint site. However, at architecture level, the operation of exporting a SharePoint site as XML template is very similar, but doing it in the opposite way. The cycle to apply an XML template to a SharePoint site works in 2 main steps. First, the content of the XML file is loaded to a business object “ProvisioningTemplate”, aftwerwards, this business object is run by the framework, doing the operations required in SharePoint.

The first step will be the following piece of code:


And internally, this is the process that the Framework has followed:
  1. Everything begins with the call to the method GetTemplate of a class that inherits from TemplateProviderBase.
  2. The Framework has support for defined templates both in XML and insi bi JSON, although the format is more extended in XML, and in fact I do not know anyone that uses JSON. Depending on the JSON/XML format, the class inherits from JsonTemplateProvider or XmlTemplateProvider. Besides, the Framework permits different storage for the file of the template, being able to store the file in the FileSystem, in a Blog Storage of Azure, or even in a SharePoint document library.
  3. The specific class TemplateProvider, will have property class base FileConnectorBase, with 3 specific implementations, that will connect to the storage system used: FileSystem, Azure Storage, SharePoint.
  4. The result of the connector FileConnectorBase will be a Stream represented by the content of the template XML/JSON.
  5. That Steam, goes through a class that implements the interface ITemplateFormatter, which converts the Stream to a business object ProvisioningTemplate. There are two implementations of this ITemplateFormatter, depending on if we are working with XML or JSON: XMLPnPSchemaFormatter and JsonPnPSchemaFormatter.
  6. Finally, when the Formatter finishes its tasks, we get a ProvisioningTemplate object, which contains properties of another business objects, representing entirely the template: Fields, ContentTypes, Files, Lists, etc.
Once the XML/JSON is converted in a ProvisioningTemplate, the Framework runs the object and applies the operations required in SharePoint, like create the columns, lists, upload files, apply settings, etc.This final step starts with the following piece of code:
And the following image describes the process applied:

  1. We start from the Provisioning Template loaded in the previous step.
  2. The extension of the object Web: ApplyProvisioningTemplate is invoked.
  3. The TokenParser class, translates the tokens used in the Template. There is a system of “Tokenizing”, that makes possible to use tokens in the XML and JSON, that are resolved in this moment with values depending on the context (for example, ~sitecollectionurl). You can see all the tokens available in the folder: OfficeDevPnP.Core\Framework\Provisioning\ObjectHandlers\TokenDefinitions.
  4. All the ObjectHandler are executed following a specific sequence. Each ObjectHandler is responsible for provisioning a part of the template to SharePoint. For example, the ObjectField will create Site Columns of the template in SharePoint.
  5. At this point, the Framework will call all our own Extensibility Handlers that we previously defined in the template. At this moment is when we can “inject” our own provisioning actions. For example, it can be very interesting to send an email when a template is applied, or make an integration with an external system, or any other action in SharePoint that is not supported by the Framework. With the execution of all the ObjectHandler, including our own ones, the provisioning process finishes.

Following PnP Program

Remember the following ways of being up to date with the PnP program:
  • Yammer Network:

This is possibly the best way of keeping up to date about PnP. Besides, you can submit your comments and questions and get help from the PnP team.  
  • Channel PnP in Channel 9:

Presentation videos and examples of PnP use.

  • PnP blog:
  • Community call:

Write down this date in your calendar.  Every month the PnP team holds a meeting at which they inform about the program’s state, the roadmap, they also show examples, etc. It is a real pleasure to be able to meet with the PnP team and receive updates from Vesa himself.


Add your comment





intranet Modern SharePoint teamwork employee engagement digital workspace SharePoint JavaScript Windows Azure Digital Transformation staff satisfaction productivity Microsoft Teams Office 365 Yammer cms content management system agile GDPR Microsoft Graph collaboration Microsoft sharepoint 2016 upgrade migration SharePoint Online 2016 Tech Trends Digital Disruption Context marketing marketing SharePoint 2010 SharePoint 2013 TFS Git security kentico Analytics jquery QA Quality Assurance testing content management websites Sitecore sitecore marketplace sitecore module cloud Microsoft Cloud Storage digital strategy technical consulting sitecore modules Experience database Sitecore 7 Sitecore 8 support account management customer experience Data Storage cms integration front end front end development prototype Cloud Storage StorSimple Front-end Development Layout SharePoint 2013 colour palette UI design website design log viewer sitecore cms website Azure big data business-critical sharepoint accessibility android apple chrome clear people clearpeople debug emulator ios mobile testing opera resize adobe desktop flash ie10 internet explorer 10 metro windows 8 bcsp Advanced System Reporter reporting framework ControlMode form control master page placeholder publishing console SharePoint 2007 SharePoint error search search results search values software testing testing scenario audit content information architecture retention schedules PowerShell QuickLaunch scripts SharePoint server 2010 business solutions metalogix replication replicator storagepoint stena technet UK Technet picture library slideshow web part RTM released to manufacturing caml caml query MOSS 2007 query infopath