X
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.
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:

https://github.com/OfficeDev/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:

https://github.com/OfficeDev/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:

https://github.com/OfficeDev/PnP-PowerShell

Power-Shell Command enables more useful methods.

 

PnP:

https://github.com/OfficeDev/PnP

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: 

https://github.com/OfficeDev/PnP/tree/master/Samples/Branding.ApplyBranding

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

 

Core Create Content Types: 

https://github.com/OfficeDev/PnP/tree/master/Samples/Core.CreateContentTypes

It allows to create Content Types using PnP Core.

 

Core Embed JavaScript:

https://github.com/OfficeDev/PnP/tree/master/Samples/Core.EmbedJavaScript

Good practice when injecting JavaScript and updating User Interface.

 

Core MMSSync: 

https://github.com/OfficeDev/PnP/tree/master/Samples/Core.MMSSync

Syncronization of Metadata TermStore through multiple TermStores.

 

Provisioning Cloud Async Webjob: 

https://github.com/OfficeDev/PnP/tree/master/Samples/Provisioning.Cloud.Async.WebJob

Creation of Site Collections from a WebJob in Azure.

 

UserProfile Manipulation CSOM Console: 

https://github.com/OfficeDev/PnP/tree/master/Samples/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: 

https://github.com/OfficeDev/PnP-Provisioning-Schema/blob/master/ProvisioningSchema-2015-12.md


Note:
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: 

https://github.com/OfficeDev/PnP-Provisioning-Schema/blob/master/Samples/ProvisioningSchema-2015-12-ReferenceSample-01.xml

 

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

https://github.com/OfficeDev/PnP-PowerShell/blob/c1cacc5394908c996fd543f887463702cf63a9d9/Documentation/ApplySPOProvisioningTemplate.md

 

Get-SPOProvisioningTemplate

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: 

https://www.yammer.com/itpronetwork 

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: 

https://channel9.msdn.com/blogs/OfficeDevPnP 

Videos with demos and examples of use of PnP


PnP Blog: 

http://dev.office.com/blogs


Monthly community call of PnP:

https://github.com/OfficeDev/PnP/wiki/Community-call 


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
SharePoint and Cloud Solution Architect
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


comments powered by Disqus

Related Articles

Sign up to our Newsletter

Every now and then, we'd like to send you information that delivers, develops and promotes our products and services that are relevant to you. Submitting your details tells us that you're OK with this and you also agree to our Privacy & Cookies policy. You can, of course, opt out of these communications at any time.