Monthly Archives: February 2016

PnP Provisioning

Getting started with Office Dev PnP Provisioning

Office Dev PnP provides a site provisioning engine to create sites and site collections within a SharePoint Online tenant or a SharePoint farm based on a given definition. This definition is an object describing the to be provisioned components like list, libraries and features. But also SharePoint security groups, users, site property bags entries and Composed Looks.

With the template provider the definition object can be transformed to JSON or XML. This works in both ways, so you can transform a XML definition into an object. Therefore you are able to define the structure of a site or site collection in a XML template. The definition object will be referred to as PnP template.

Classic site provisioning techniques

Below are a few classic site provisioning techniques. Vesa Juvonen explains these techniques in more detail.

Site Definition
Requires full trust solutions, which means it is not possible to use in Office 365. Also it will be difficult to migrate site definitions to newer versions of SharePoint.

Site Templates
Not possible to create site collections without workarounds and is difficult to upgrade. This method is however possible on Office 365.

Web Templates
Not possible to create site collections without workarounds. This method is however possible on Office 365.

Server side provisioning
Provides standardization of site creation in code and is easy to upgrade. Requires full trust solutions, which means it is not possible to use in Office 365.

Introducing remote provisioning and PnP Provisioning

The modern way of site provisioning is remote provisioning. Remote provisioning uses the Client Side Object Model (CSOM) or the REST API to create a site and fill this site incrementally with CSOM/REST requests. This model is suitable for both on-premises and Office 365 since we control the customizations outside of the SharePoint farm in an independent solution.

To improve the experience using remote provisioning, the Office Dev PnP team created PnP Provisioning. As mentioned earlier, a really great part of PnP Provisioning is defining a site template in a XML using the PnP Provisioning Schema. In my next blog post I will explain how to create a site based on a template defined using the PnP Provisioning Schema.

Further information

Introduction to the Office Dev PnP Program

Many organizations using SharePoint have created legacy solutions on the platform. This lead to all kinds of migration problems. Since these legacy problems prevented customers to migrate to the cloud, Microsoft started an initiative to ease these problems. And so in 2013 the Office Dev Patterns and Practices Program was born, shortly Office Dev PnP.

Office Dev PnP originally started as a Microsoft initiative to help customers migrate their on-premises farms to the Microsoft cloud. Soon it introduced many helper code and examples to provide the basic plumbing and optimize your workflow.

Components

All components of Office Dev PnP are placed on GitHub. It started in a single repository, but soon the volume of the program became so large, the Office Dev PnP team decided to split the individual components in separate repositories.

PnP
The original repository which now only contains samples.

PnP Sites Core
Contains the core library and the PnP provisioning engine. The PnP provisioning engine helps to deploy customizations to remote SharePoint environments.

PnP PowerShell
Contains PowerShell wrappers to the functionalities of PnP Core.

PnP Partner Pack
Contains the PnP Partner Pack, a starter kit for customers and partners and combines numerous patterns and practices demonstrated in the PnP samples to one reusable solution, which can be deployed and used in any Office 365 tenant.

PnP Guidance
Contains the documentation and guidance of the program. The contents of the master branch are published to dev.office.com and MSDN.

PnP Office Add-ins
Contains samples of how to work with the HTML and JavaScript based Office add-in model.

PnP Tools
Contains more tools, code packages and scripts for the on-premises and hybrid setup, than purely for the Office 365 operations. Using classic terminology, this could be considered more targeted for IT pro’s, architects and administrators in on-premises deployments.

PnP Transformation
Contains the farm solution to add-in model transformation tooling and guidance.

PnP Provisioning Schema
Contains the provisioning schema for PnP Provisioning, a community driven effort for designing one schema which can be used to define elements in the Office 365.

Resources

Office Dev PnP has many resources. In the picture below are the official channels.

Overview Office Dev PnP Resources

Contribute to PnP

Office Dev PnP is completely open source. Microsoft and the Office Dev PnP team encourage you to contribute to the program. When using the Office Dev PnP resources, you will probably encounter bugs or come up with improvements. Please report the issues to the PnP projects on GitHub or contribute your own fixes by creating pull requests.

Restore the default SharePoint groups for a SharePoint site

A SharePoint group is a collection of users who all have the same set of permissions, or permission level. Certain groups are created by default when you create a SharePoint site or activate certain features, these are known as the default SharePoint groups. The default groups use default permission levels to grant users rights and access.

Associated groups

Each SharePoint site has three associated groups (AssociatedOwnerGroup, AssociatedMemberGroup and AssociatedVisitorGroup) who define which SharePoint groups are designated as Owners, Members or Visitors groups of a site respectively. When role inheritance is broken, by the default these SharePoint groups are “<sitename> Owners”, “<sitename>” Members and “<sitename> Visitors”.

The problem

When these associated groups are not created on site creation or when one or more of the associated groups are deleted, you need to (re)create those associations (if you want the default Owners, Members and Visitors groups as SharePoint creates them). Unfortunately SharePoint doesn’t offer an intuitive interface to do this.

Create the missing SharePoint groups

To restore the default SharePoint groups, you first need to make sure the default groups exist. Go to <site URL>/_layouts/15/groups.aspx to make sure the following groups are present:

  • <site name> Owners
  • <site name> Members
  • <site name> Visitors

If not you have to create the missing manually (New > New Group) with the corresponding permission levels, as shown below.

Default groups of SharePoint site

Set the SharePoint groups a default groups

When the default groups are present, you have to create the associations. Go to <site URL>/_layouts/15/permsetup.aspx and select the corresponding default groups in the form.

Set group associations of SharePoint site

Finally, press OK to create the associations. Now the default SharePoint groups of the site are restored.