Template Entity updates

From Make 5.5 the following entities are added or updated with new functionality.

ModernSite provisioning (SharePoint online)

Make 5.5 supports provisioning of ModernSites. For now, these ModernSites is limited to Communication Sites and Team Sites without a Unified Groups. More features might become available in the future. In order to provision a ModersIte you need to create a Configuration.xml file.

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<Configurator xmlns="http://schemas.mavention.com/SharePoint/Apps/SiteConfigurator">
  <Providers>
    <Provider Assembly="Mavention.Make.Engine" Class="Mavention.Make.Engine.Providers.ModernSiteProvider" NodeName="ModernSite"></Provider>
  </Providers>
  <ModernSite Url="{url}" Title="{title}" OwnerLogin="{siteowner}" ObjectAction="Create" SiteDesign="Blank" LCID="1033" Template="SITEPAGEPUBLISHING#0">
    <RootWeb LCID="1033" Title="{title}" Url="{url}" Description="{description}">
      <Properties>
        <Property Name="WebTemplate">Make.ModernSite</Property>
        <Property Name="WebTemplateVersion">1.0.0.0</Property>
      </Properties>
    </RootWeb>
  </ModernSite>
</Configurator>

Set the StartObjectType to Tenant and Assign the follow parameters for the example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
	"d": {
		"parameters": [{
			"id": "url",
			"title": "Site URL",
			"inputType": "text",
			"required": true,
			"sampleValue": "https:// yourtenant.sharepoint.com/sites/communicationsitewithmake"
		}, {
			"id": "title",
			"title": "Title",
			"inputType": "text",
			"required": true,
			"sampleValue": "Communication site with Make"
		}, {
			"id": "description",
			"title": "Description",
			"inputType": "multiline",
			"required": false,
			"sampleValue": "Communicate on this site"
		}, {
			"id": "siteowner",
			"title": "Siteowner",
			"inputType": "text",
			"required": false,
			"sampleValue": "user@yourtenant.onmicrosoft.com"
		}]
	}
}

Apply the template to the following configuration location (replace ‘yourtenant’ with the name of your tenant):
https://yourtenant.onmicrosoft.com/

Webhook support (SharePoint online)

It is possible to add a Webhook on a SharePoint list. The webhook can only be placed on a list when an API with a webhook endpoint is running. Go to: https://docs.microsoft.com/en-us/sharepoint/dev/apis/webhooks/overview-sharepoint-webhooks for more information. If you want to put several webhooks on a single list, each webhook must have a unique NotificationUrl.

Template:

1
2
3
4
5
6
7
8
<Lists>
    <List Description="Description of the list" Title="Title of the list" TemplateType="100" GetObjectBy="Default" Url="Lists/WebhookList">
        <Webhooks>
            <Webhook NotificationUrl="https://0fe2d846.ngrok.io/api/spwebhook/handlerequest" ExpirationDateTime="2019-06-27T16:17:57+00:00" ClientState="TestWebhook"></Webhook>
            <Webhook NotificationUrl="https://506c83e5.ngrok.io/api/spwebhook/handlerequest" ExpirationDateTime="2019-07-27T16:17:57+00:00" ClientState="TestWebhookTwo"></Webhook>
        </Webhooks>
    </List>
</Lists>

Parameters:

  • NotificationUrl
    The Webhook endpoint of the running API
  • ExpirationDateTime
    The DateTime when the webhook expires (max 6 months in the future)
  • ClientState (optional)
    Type whatever you want here
  • Id (optional, not recommended)
    The Id (Id of the subscription of the webhook) can only be used when updating the webhook. The webhook can also be updated without using the Id. It is recommended to not use the Id. The Id must be known if you want to use it.
  • GetObjectBy (optional)
    • Default: GetByUrl
    • Url: retrieves the webhook on the specified list according to the NotificationUrl
    • Id: can only be used when you know the Id

Enable Site Collection App Catalog

Site collection app catalogs are disabled by default. They can now be enabled through make by setting an attribute on the site entity:

Example:

1
2
3
<Site Url="{url}" Title="{title}" Template="STS#0" LCID="{lang}" OwnerLogin="john.doe@contoso.com" EnableSiteCollectionAppCatalog="true">
<!-- site template -->
</Site>

Modern page and modern webparts support

From Make 5.5 onward, modern pages along with modern webparts can be provisioned with Make.

Modern pages

The xml element used to create modern pages is <ClientSidePage>. Modern pages require at least a name that ends with “.aspx”. The page can be configured in the following ways:

  • The promoted state can be set (pages are not promoted by default)
  • Comments can be disabled (comments are enabled by default)
  • The header image can be set by providing a server relative URL
  • The header author can be set by providing a user’s email address
    Example:
1
2
3
<ClientSidePage Name="modernPageSample.aspx" HeaderAuthor="john.doe@contoso.com" Promoted="PromoteOnPublish" Title="Lorem Ipsum" DisableComments="true" HeaderImageUrl="/sites/sampleSite/SiteAssets/sample-image.jpg">
     <!-- Page content -->
</ClientSidePage>

In order to further customize the page header on a modern page, the <PageHeader> element can be added to the <ClientSidePage> and configured in the following ways:

  • the alignment of the content can be set to either “Left” or “Center”
  • a topic header can be shown or hidden and set, this is a subtitle shown in the page header
  • the publishing date can be shown or hidden
  • different layouts can be chosen for the page header
  • The header image can be set by providing a server relative URL
  • The header author can be set by providing a user’s email address
    Example:
1
2
3
4
5
<ClientSidePage Name="modernPageSample.aspx">
<PageHeader Alignment="Center" HeaderAuthor="john.doe@contoso.com" HeaderImageUrl="/sites/sampleSite/SiteAssets/sample-image.jpg " ShowTopicHeader="true" HeaderLayout="FullWidthImage" ShowPublishDate="true" Title="Lorem Ipsum" TopicHeader="page topic header"/>

<!-- Page content -->
</ClientSidePage>

Modern webparts

Modern webparts can be added to modern pages by using the <TextWebpart> elements for text webparts or the <ClientSideWebpart> element for all other OOTB webparts. The text webparts support html markdown and can contain any text as long as it’s xml safe (i.e. xml illegal characters should be escaped):

1
2
3
4
5
<ClientSidePage Name="modernPageSample.aspx">
<TextWebpart>
   		&lt;b&gt;Lorem &lt;/b&gt; ipsum dolor sit amet
</TextWebpart>
</ClientSidePage>

The <ClientSidePage> element should contain the webpart data json. The webpart data can be obtained as follows:

  • create a modern page in SharePoint
  • configure the webpart as you require and save the page
  • add “?maintenanceMode=true” to the url in the address bar (i.e.: /SitePages/samplePage.aspx?maintenanceMode=true)
  • the webpart data is shown on the Data tab:

Figure 1: Data tab

Figure 1: Data tab

  • copy the json and paste it inside the <ClientSideWebpart> element, make sure xml illegal characters are escape for example < and > should become &lt; and &gt; respectively:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
              <!-- embed webpart -->
<ClientSidePage Name="modernPageSample.aspx">
              <ClientSideWebpart >
                {
                "id": "490d7c76-1824-45b2-9de3-676421c997fa",
                "instanceId": "49d93465-b5a1-4661-882d-80b24f4221f8",
                "title": "Insluiten",
                "description": "Inhoud van andere sites insluiten zoals van Sway, YouTube, Vimeo en meer",
                "serverProcessedContent": {
                "htmlStrings": {},
                "searchablePlainTexts": {
                "captionText": ""
                },
                "imageSources": {},
                "links": {}
                },
                "dataVersion": "1.0",
                "properties": {
                "embedCode": "&lt;iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/XysRGYNtpgI\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\"&gt;&lt;/iframe&gt;",
                "cachedEmbedCode": "&lt;iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/XysRGYNtpgI\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\"&gt;&lt;/iframe&gt;",
                "shouldScaleWidth": true,
                "tempState": {},
                "cachedEmbedCodeThumbnail": ""
                }
                }
              </ClientSideWebpart>
</ClientSidePage>

Modern webparts can also be grouped together in <Section> elements within the <ClientSidePage> element, these sections can be seen as rows within the page. So the webparts in the first <Section> element within a <ClientSidePage> element are shown above the webparts declared in the second <Section> element:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<ClientSidePage Name="modernPageSample.aspx">
    <Sections>
    <Section>
        <TextWebpart>
        This will be shown first
        </TextWebpart>
    </Section>
    <Section>
        <TextWebpart>
        This will be shown second
        </TextWebpart>
    </Section>
    </Sections>
</ClientSidePage>

Sections can be configured by:

  • setting a background: None (default), Neutral, Soft, Strong
  • setting a section template: OneColumnFullWidth (default), TwoColumn, ThreeColumn, TwoColumnRight, TwoColumnLeft

Columns are vertical groupings of webparts within a section. Webparts are designated to a column by setting the Column attribute on the webpart element, the vertical order of the webpart is set through the Order attribute:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<ClientSidePage Name="modernPageSample.aspx">
    <Sections>
    <Section SectionTemplate="TwoColumn">
        <TextWebpart Column="1" Order="1">
        This will be the top left webpart
        </TextWebpart>
        <TextWebpart Column="1" Order="2">
        This will be the bottom left webpart
        </TextWebpart>
        <TextWebpart Column="2" Order="1">
        This will be the top right webpart
        </TextWebpart>
        <TextWebpart Column="2" Order="2">
        This will be the bottom right webpart
        </TextWebpart>
    </Section>
    </Sections>
</ClientSidePage>

If webparts are declared inside the <ClientSidePage> element rather than in a <Section> element, they are automatically assigned to a one column full width section with no background color.

Search Configuration Export and Import

Export

To export the search configuration navigate to “Make Configuration”, enter the site URL from which the search configuration needs to be exported, enter an export name and select the “Search Settings” scope. Click submit to add this export to the queue.

Figure 2: Export Search Settings

Figure 2: Export Search Settings

Import

The exported search configuration can be used in a template of choice. Copy the “SearchSettings” part of the export (see below) to the desired configuration template and paste it inside the “Site” element.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<SearchSettings>
      <SearchConfigurationSettings xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Microsoft.Office.Server.Search.Portability">
        <SearchQueryConfigurationSettings>
          <SearchQueryConfigurationSettings>
            <BestBets xmlns:d4p1="http://www.microsoft.com/sharepoint/search/KnownTypes/2008/08" />
            <DefaultSourceId>00000000-0000-0000-0000-000000000000</DefaultSourceId>
            <DefaultSourceIdSet>true</DefaultSourceIdSet>
            <DeployToParent>false</DeployToParent>
            <DisableInheritanceOnImport>false</DisableInheritanceOnImport>
            <QueryRuleGroups xmlns:d4p1="http://www.microsoft.com/sharepoint/search/KnownTypes/2008/08" />
            <QueryRules xmlns:d4p1="http://www.microsoft.com/sharepoint/search/KnownTypes/2008/08" />
            <ResultTypes xmlns:d4p1="http://schemas.datacontract.org/2004/07/Microsoft.Office.Server.Search.Administration" />
            <Sources xmlns:d4p1="http://schemas.datacontract.org/2004/07/Microsoft.Office.Server.Search.Administration.Query" />
            <UserSegments xmlns:d4p1="http://www.microsoft.com/sharepoint/search/KnownTypes/2008/08" />
          </SearchQueryConfigurationSettings>
        </SearchQueryConfigurationSettings>
        <SearchRankingModelConfigurationSettings>
          <RankingModels xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
        </SearchRankingModelConfigurationSettings>
        <SearchSchemaConfigurationSettings>
          <Aliases xmlns:d3p1="http://schemas.datacontract.org/2004/07/Microsoft.Office.Server.Search.Administration">
            <d3p1:LastItemName i:nil="true" />
            <d3p1:dictionary xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
          </Aliases>
          <CategoriesAndCrawledProperties xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
          <CrawledProperties xmlns:d3p1="http://schemas.datacontract.org/2004/07/Microsoft.Office.Server.Search.Administration" i:nil="true" />
          <ManagedProperties xmlns:d3p1="http://schemas.datacontract.org/2004/07/Microsoft.Office.Server.Search.Administration">
            <d3p1:LastItemName i:nil="true" />
            <d3p1:dictionary xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
            <d3p1:TotalCount>0</d3p1:TotalCount>
          </ManagedProperties>
          <Mappings xmlns:d3p1="http://schemas.datacontract.org/2004/07/Microsoft.Office.Server.Search.Administration">
            <d3p1:LastItemName i:nil="true" />
            <d3p1:dictionary xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
          </Mappings>
          <Overrides xmlns:d3p1="http://schemas.datacontract.org/2004/07/Microsoft.Office.Server.Search.Administration">
            <d3p1:LastItemName i:nil="true" />
            <d3p1:dictionary xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
          </Overrides>
        </SearchSchemaConfigurationSettings>
        <SearchSubscriptionSettingsConfigurationSettings i:nil="true" />
        <SearchTaxonomyConfigurationSettings i:nil="true" />
    </SearchConfigurationSettings>
</SearchSettings>