In this blog I will explain how to apply a lookup column using a Mavention Make template.
Considerations:
- Before the lookup column can be created, the list where the lookup column refers to should allready exist.
Example
In the example below I will create a lookup column on sitecollection level and list level. Because I can’t create a lookup column that refers to a list that doesn’t exist, I have to create this list first. I will use multiple site XML nodes to control the timing when the SharePoint objects are created.
<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">Lookup column</Property> <Property Name="WebTemplateVersion">0.0.0.1</Property> </Properties> <Lists> <List Url="Lists/Contactpersonen" TemplateType="105" TemplateFeatureId="00bfea71-7e6d-4186-9ba8-c047ac750105" Title="Contactpersonen" /> </Lists> </RootWeb> </Site> <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}"> <Fields> <FieldLookup Name="MVEigenaar" Id="aa594d5d-de3e-4f35-9a3a-0d0e1b8d9671" DisplayName="Eigenaar" AllowMultipleValues="false" LookupField="Title" LookupList="Contactpersonen" LookupWeb="{url}" Required="false" Group="Mavention" Description="" /> </Fields> <Lists> <List Url="Bibliotheek" TemplateType="101" TemplateFeatureId="00bfea71-e717-4e80-aa17-d0c71b360101" ContentTypesEnabled="True" Description="" EnableFolderCreation="False" EnableMinorVersions="True" EnableModeration="False" EnableVersioning="True" ForceCheckout="False" MajorVersionLimit="500" MajorWithMinorVersionsLimit="0" Title="Bibliotheek"> <Fields> <FieldLookup Name="MVEigenaar" Id="aa594d5d-de3e-4f35-9a3a-0d0e1b8d9671" DisplayName="Eigenaar" AllowMultipleValues="false" LookupField="Title" LookupList="Contactpersonen" LookupWeb="{url}" Required="false" Group="Mavention" Description="" /> </Fields> <Views> <View DefaultView="True" DefaultViewForContentType="False" Hidden="False" IncludeRootFolder="False" Paged="True" RowLimit="30" Scope="DefaultValue" Title="Alle Documenten" Toolbar="" ViewType="HTML"> <ViewFields> <FieldRef Name="DocIcon" /> <FieldRef Name="LinkFilename" /> <FieldRef Name="Modified" /> <FieldRef Name="Editor" /> <FieldRef Name="Eigenaar" /> </ViewFields> <ViewQuery><OrderBy><FieldRef Name="FileLeafRef" /></OrderBy></ViewQuery> </View> </Views> </List> </Lists> </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" }] } }
See also
The post Mavention Make lookup column appeared first on Mavention.