Today, let’s explore the Microsoft patterns and practices or PnP Provisioning Engine solution to provision SharePoint artifacts. The way this works is the business users and designers make the required changes to the UI from the browser in one site. After that, we can import this entire configuration. Then, we can create new sites or artifacts using this configuration.
Get the solution from the PnP github repository https://github.com/OfficeDev/PnP/tree/master/Solutions/Provisioning.Framework.Cloud.Async. Ensure that you set the url of your tenancy for the Provisioning.Framework.Cloud.Async
project.
If you get any error such as ‘type or namespace OfficeDevPnP could not be found’, install the OfficeDevPnP.Core NuGet
package. Right click on the project -> Manage NuGet packages and ensure you are on the online tab and search for the OfficeDevPnP.Core
and install it. Accept any license pop ups. Note that this step is not usually required. If you just build the project which you got from github, the required NuGet packages will be installed.
Now if you build and run the application, you should get a trust prompt. Click on ‘Trust it’.
It will load the default page of the provider hosted app, which is the Site Collection Creation Form. It will pick up the reference site from the web.config appSettings
key TemplateSiteUrl
. The base url will be picked from this url as well.
The solution will create and update the ClientId
and ClientSecret
in the web.config. Copy that and paste that in the other files in the solution such as app.config by searching for it.
Also getting the AccountName
and AccountKey
for Office 365 is a bit tricky. I almost gave up, but finally found this.
Go to Office 365 admin center. Click on the Import tab.
Then, click on the + symbol and ‘Upload files over network’
Click on Show key. This is your AccountKey
. Then, click on the Show URL for Email PSTs. The string
between the https:// and blob.core.windows.net is your AccountName
.
Search and update the solution with the AccountName
and AccountKey
values which you got from above.
Now, when you run the solution, the app will load with the ‘Site Collection Creation’ form.
Once you click on Create, it will go ahead and place a request for the site collection as this is asynchronous.
All the customizations including the lists and libraries, views and any other customizations will be present in the new site.
This is not based on a template or site definition. It creates a new site and then updates the configurations using the object model. This is more robust as it is not dependent on the template files on the file system. Or, it is only dependent on the out of the box files provided by SharePoint.
The post PnP Provisioning Engine appeared first on SharePoint Guide.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.