Appling multiple templates sequential after each other using site XML nodes in a Mavention Make template, allows you to provision more complex structures.
When to use multiple site XML nodes?
- Control the timing when the SharePoint objects are created, like by adding a document template to a content type.
Considerations:
- You cannot mix PnP templates in a Mavention Make template;
- Besides the use of multiple site XML nodes, you could also define a playlist. 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
In the example below we have defined two ‘Site’ XML nodes, where you can separate and/or control the timing when the SharePoint objects are created.
Note that in the second ‘Site’ XML node we defined a ObjectAction=”None”. What this does is that the Mavention Make engine does only get the SharePoint object but does not change anything.
<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">My First Mavention Make Site</Property> <Property Name="WebTemplateVersion">0.0.0.1</Property> </Properties> </RootWeb> </Site> <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}"> <!-- Do more stuff --> </RootWeb> </Site> </Configurator>
Parameters
{ "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" }] } }
Example: Add document template to a content type
In this example we want to add a document template to a content type in SharePoint. This requires that the document already exists before you can add it to the Content Type. Therefor we use multiple ‘Site’ XML nodes in a Mavention Make Template, to ensure that the necessary SharePoint objects are available.
<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">Make template word template</Property> <Property Name="WebTemplateVersion">0.0.0.1</Property> </Properties> <Fields> <Field Name="MVNamePerson" DisplayName="Name person" Id="550a7eec-4994-4675-8cd9-0b77699a9840"> <![CDATA[<Field Type="Text" DisplayName="Name person" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" MaxLength="255" Group="Mavention" ID="{550a7eec-4994-4675-8cd9-0b77699a9840}" StaticName="MVNamePerson" Name="MVNamePerson"></Field>]]></Field> <Field Name="MVEnlistment" DisplayName="Enlistment" Id="49504f7c-ca28-44f6-8e89-428129f4d073"> <![CDATA[<Field Type="DateTime" DisplayName="Enlistment" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" Format="DateOnly" Group="Mavention" FriendlyDisplayFormat="Disabled" ID="{49504f7c-ca28-44f6-8e89-428129f4d073}" StaticName="MVEnlistment" Name="MVEnlistment"></Field>]]></Field> <Field Name="MVLocation" DisplayName="Location" Id="de823fb6-3617-4586-88bd-ede92ff41450"> <![CDATA[<Field Type="Text" DisplayName="Location" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" MaxLength="255" Group="Mavention" ID="{de823fb6-3617-4586-88bd-ede92ff41450}" StaticName="MVLocation" Name="MVLocation"></Field>]]></Field> </Fields> <ContentTypes> <ContentType Title="Contract" Description="" Group="Mavention" Id="0x01010017A0BE4284A7284791DB1C3DE9D040E6"> <FieldRefs> <FieldRef Id="550a7eec-4994-4675-8cd9-0b77699a9840" Name="MVNamePerson" /> <FieldRef Id="49504f7c-ca28-44f6-8e89-428129f4d073" Name="MVEnlistment" /> <FieldRef Id="de823fb6-3617-4586-88bd-ede92ff41450" Name="MVLocation" /> </FieldRefs> </ContentType> </ContentTypes> <Lists> <List Url="Contracten" TemplateType="101" TemplateFeatureId="00bfea71-e717-4e80-aa17-d0c71b360101" HasUniqueRoleAssignments="true" CopyRoleAssignments="false" ContentTypesEnabled="True" Title="Contracten" ExcludeFromOfflineClient="False" EnableVersioning="true"> <ContentTypes> <ContentType Title="Contract" Description="" Group="Mavention" ParentContentTypeId="0x01010017A0BE4284A7284791DB1C3DE9D040E6" /> <ContentType GetObjectBy="DisplayName" Title="Document" ObjectAction="Delete"/> </ContentTypes> <Views> <View Aggregations="" AggregationsStatus="Off" DefaultView="True" DefaultViewForContentType="False" Hidden="False" IncludeRootFolder="False" JSLink="clienttemplates.js" Paged="True" RowLimit="30" Scope="DefaultValue" Title="Alle documenten" Toolbar="" ViewType="HTML"> <ViewData /> <ViewFields> <FieldRef Name="DocIcon" /> <FieldRef Name="LinkFilename" /> <FieldRef Name="Modified" /> <FieldRef Name="Editor" /> <FieldRef Name="MVNamePerson" /> <FieldRef Name="MVEnlistment" /> <FieldRef Name="MVLocation" /> </ViewFields> <ViewQuery><OrderBy><FieldRef Name="FileLeafRef" /></OrderBy></ViewQuery> </View> </Views> </List> </Lists> </RootWeb> </Site> <!--Upload Wordtemplate--> <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}"> <Folders> <Folder Name="_cts"> <Folders> <Folder Name="Contract"> <Files> <File Name="Contract.docx" FileSource="assets/Contract.docx" Overwrite="true"/> </Files> </Folder> </Folders> </Folder> </Folders> </RootWeb> </Site> <!--Update Contenttype--> <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}"> <ContentTypes> <ContentType Title="Contract" Description="" Group="Mavention" Id="0x01010017A0BE4284A7284791DB1C3DE9D040E6" DocumentTemplate="Contract.docx"/> </ContentTypes> </RootWeb> </Site> </Configurator>
Parameters
{ "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" }] } }
Related articles
- Getting started with Mavention Make
- Creating sub-sites using Mavention Make
- PnP Template Example
- Mavention Make playlist
The post Mavention Make multiple site nodes appeared first on Mavention.