In Blogs, Mavention Make, Techblog

Appling multiple templates sequential after each other using Mavention Make playlists,  allows you to provision more complex structures. Using multiple templates in a playlist, you can separate structure and content provisioning. If you already have existing PnP templates and you need to provision a specific item with Mavention Make or you want to transit to Make templates, it is possible to mix Make and PnP templates in one playlist.

When to use playlists?

  • Extending base templates;
  • Separate structure and content;
  • Using Make and PnP templates together.

Considerations:

  • You cannot use a playlist to create sites using multiple PnP templates. This is due a limitation of the SharePoint PnP Provisioning engine;
  • Besides the use of a playlist, you could also define multiple site XML nodes in a Make Template. The main difference between these approches is, that with a playlist you can define different templates like mixing Make template(s) with a PnP template.

Example

playlist.xml

<?xml version="1.0" encoding="utf-8" ?>
<Configurator xmlns="http://schemas.mavention.com/SharePoint/Apps/SiteConfigurator">
   <Providers>
      <Provider NodeName="Playlist" Class="Mavention.SharePoint.SiteConfigurator.Providers.PlaylistProvider" Assembly="Mavention.SharePoint.SiteConfigurator"/>
   </Providers>
   <Playlist>
      <Files>
         <ConfigurationFile FileName="configuration.xml" FileType="Make" />
         <ConfigurationFile FileName="configuration.PnP.xml" FileType="PnP" />
      </Files>
   </Playlist>
</Configurator>

configuration.xml

<Configurator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.mavention.com/SharePoint/Apps/SiteConfigurator">
   <Providers>
      <Provider NodeName="Site" Class="Mavention.SharePoint.SiteConfigurator.Providers.SiteProvider" Assembly="Mavention.SharePoint.SiteConfigurator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a43c589e76ba4e3d"/>
   </Providers>
   <Site Url="{url}" Title="{title}" OwnerLogin="{siteowner}" Template="STS#0" LCID="1043" StorageQuota="1024" TimeZoneId="4">
      <RootWeb LCID="1043" Title="{title}" Url="{url}" Description="{description}">
         <Properties>
            <Property Name="WebTemplate">Project</Property>
            <Property Name="WebTemplateVersion">0.0.0.1</Property>
         </Properties>
      </RootWeb>
   </Site>
</Configurator>

configuration.PnP.xml

<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2015/12/ProvisioningSchema">
   <pnp:Preferences Generator="OfficeDevPnP.Core, Version=2.5.1606.2, Culture=neutral, PublicKeyToken=3751622786b357c2" />
   <pnp:Templates ID="CONTAINER-TEMPLATE-AEEACB63B4F94D98A33D42099B3E33E1">
      <pnp:ProvisioningTemplate ID="TEMPLATE-AEEACB63B4F94D98A33D42099B3E33E1" Version="1">
         <pnp:Properties>
            <pnp:Property Key="mvMakeBaseTemplate" Value="STS#0" />
         </pnp:Properties>
         <pnp:PropertyBagEntries>
            <pnp:PropertyBagEntry Key="WebTemplate" Value="BaseTemplate" Overwrite="false" />
            <pnp:PropertyBagEntry Key="WebTemplateVersion" Value="1.0.0.0" Overwrite="false" />
         </pnp:PropertyBagEntries>
      </pnp:ProvisioningTemplate>
   </pnp:Templates>
</pnp:Provisioning>

Parameters (playlist.xml)

Notice that all parameters defined to be used in your Make templates are combined with the required PnP parameters.

{
   "d": {
      "parameters": [
      {
         "id": "url",
         "title": "Site URL",
         "inputType": "text",
         "required": true,
         "sampleValue": "/sites/newsite"
      }, {
         "id": "Title",
         "title": "Title",
         "inputType": "text",
         "required": true,
         "sampleValue": "Site title"
      }, {
         "id": "Lcid",
         "title": "Language",
         "inputType": "text",
         "required": false,
         "sampleValue": "1043",
         "value": "1043"
      }, {
         "id": "TimeZoneId",
         "title": "TimeZoneId",
         "inputType": "text",
         "required": false,
         "sampleValue": "4",
         "value": "4"
      }, {
         "id": "StorageMaximumLevel",
         "title": "StorageMaximumLevel",
         "inputType": "text",
         "required": false,
         "sampleValue": "1024",
         "value": "1024"
      }, {
         "id": "Owner",
         "title": "Owner",
         "inputType": "text",
         "required": false,
         "sampleValue": "site-owner@mavention.nl"
      }]
   }
}

Example: Extending base template

In this example we have a base template that is used by one or more specific templates.

Project site template

The project site template exists of a playlist (playlist.xml) that includes a base site template (basesite.xml) and a project site template (projectsite.xml).
Where the base site template is located in another folder than the project site template.

playlist.xml

The playlist ensures that the base template is provisioned and then continues with provisioning the project site.

<?xml version="1.0" encoding="utf-8" ?>
<Configurator xmlns="http://schemas.mavention.com/SharePoint/Apps/SiteConfigurator">
   <Providers>
      <Provider NodeName="Playlist" Class="Mavention.SharePoint.SiteConfigurator.Providers.PlaylistProvider" Assembly="Mavention.SharePoint.SiteConfigurator"/>
   </Providers>
   <Playlist>
      <Files>
         <ConfigurationFile FileName="../BaseTemplate/basesite.xml" FileType="Make" />
         <ConfigurationFile FileName="projectsite.xml" FileType="Make" />
      </Files>
   </Playlist>
</Configurator>

Parameters (playlist.xml)

{
 "d": {
 "parameters": [{
 "id": "url",
 "title": "Site URL",
 "inputType": "text",
 "required": true,
 "sampleValue": "https://tenant.sharepoint.com/sites/sitecollectie"
 }, {
 "id": "title",
 "title": "Title",
 "inputType": "text",
 "required": true,
 "sampleValue": "My Team"
 }, {
 "id": "description",
 "title": "Description",
 "inputType": "multiline",
 "required": false,
 "sampleValue": "Site for My Team"
 }, {
 "id": "siteowner",
 "title": "Siteowner",
 "inputType": "text",
 "required": false,
 "sampleValue": "site-owner@tenant.onmicrosoft.com"
 }]
 }
}

projectsite.xml

<Configurator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.mavention.com/SharePoint/Apps/SiteConfigurator">
   <Providers>
      <Provider NodeName="Site" Class="Mavention.SharePoint.SiteConfigurator.Providers.SiteProvider" Assembly="Mavention.SharePoint.SiteConfigurator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a43c589e76ba4e3d"/>
   </Providers>
   <Site Url="{url}" Title="{title}" OwnerLogin="{siteowner}" Template="STS#0" LCID="1043" StorageQuota="1024" TimeZoneId="4" ObjectAction="None">
      <RootWeb LCID="1043" Title="{title}" Url="{url}" Description="{description}" ObjectAction="None">
         <Properties>
            <Property Name="WebTemplate">Project site</Property>
            <Property Name="WebTemplateVersion">0.0.0.1</Property>
         </Properties>
      </RootWeb>
   </Site>
</Configurator>

Base site template

The base template exists of a template file which in this example is “hidden” from the Make interface. By using the Make interface it’s not possible to use this base template to create a new site. This is accomplished by giving the template another name than ‘configuration.xml’.

basesite.xml

<Configurator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.mavention.com/SharePoint/Apps/SiteConfigurator">
   <Providers>
      <Provider NodeName="Site" Class="Mavention.SharePoint.SiteConfigurator.Providers.SiteProvider" Assembly="Mavention.SharePoint.SiteConfigurator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a43c589e76ba4e3d"/>
   </Providers>
   <Site Url="{url}" Title="{title}" OwnerLogin="{siteowner}" Template="STS#0" LCID="1043" StorageQuota="1024" TimeZoneId="4">
      <RootWeb LCID="1043" Title="{title}" Url="{url}" Description="{description}">
         <Properties>
            <Property Name="WebTemplate">Base site</Property>
            <Property Name="WebTemplateVersion">0.0.0.1</Property>
         </Properties>
      </RootWeb>
   </Site>
</Configurator>

Related articles

Vul je zoekopdracht in.