The current version of the PnP provisioning engine doesn’t like external lists.To make this work you will need to do some work.
When exporting a template external lists are included in the PnP templates, however some of the information needed to recreate the external list is missing:
<pnp:ListInstance Title="Client" Description="" DocumentTemplate="" OnQuickLaunch="true" TemplateType="600" Url="Lists/Client" MinorVersionLimit="0" MaxVersionLimit="0" DraftVersionVisibility="0" TemplateFeatureID="00bfea71-9549-43f8-b978-e47e54a10600" EnableAttachments="false" EnableFolderCreation="false"> <pnp:ContentTypeBindings> <pnp:ContentTypeBinding ContentTypeID="0x01" Default="true" /> </pnp:ContentTypeBindings> <pnp:Views> <View Name="{3EA48E9F-5C84-4DBB-8921-B81105E6A2AF}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" DisplayName="ReadAllClient" Url="/clients/template/Lists/Client/ReadAllClient.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/generic.png?rev=44"> <Method Name="ReadAllClient" /> <Query> <OrderBy> <FieldRef Name="ClientID" /> </OrderBy> </Query> <ViewFields> <FieldRef Name="ClientID" ListItemMenu="TRUE" LinkToItem="TRUE" /> <FieldRef Name="Name" /> <FieldRef Name="Sector" /> <FieldRef Name="Status" /> <FieldRef Name="KeyContact" /> <FieldRef Name="AddressID" /> </ViewFields> <RowLimit Paged="TRUE">30</RowLimit> <Aggregations Value="Off" /> <JSLink>clienttemplates.js</JSLink> </View> </pnp:Views> <pnp:Fields> <Field DisplayName="BDC Identity" Hidden="FALSE" Name="BdcIdentity" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="BdcIdentity" Type="Text" ReadOnly="TRUE" /> <Field DisplayName="ClientID" Hidden="FALSE" Name="ClientID" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ClientID" Type="Integer" ReadOnly="TRUE" Required="TRUE" /> <Field DisplayName="Name" Hidden="FALSE" Name="Name" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Name" Type="Text" /> <Field DisplayName="Code" Hidden="FALSE" Name="Code" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Code" Type="Text" /> <Field DisplayName="Sector" Hidden="FALSE" Name="Sector" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Sector" Type="Text" /> <Field DisplayName="Status" Hidden="FALSE" Name="Status" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Status" Type="Text" /> <Field DisplayName="KeyContact" Hidden="FALSE" Name="KeyContact" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="KeyContact" Type="Text" /> <Field DisplayName="AddressID" Hidden="FALSE" Name="AddressID" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="AddressID" Type="Integer" Required="TRUE" /> </pnp:Fields> </pnp:ListInstance>
When applying this list an error appears:
List ‘Client’ does not exist at site with URL ‘ Lists/Client’
When running from PnP PowerShell the full error is as follows.
PowerShell_ISE.exe Information: 0 : 2017-02-06 21:13:48.5214 [List instances] [13] [Debug] Creating list Client failed: List ‘Client’ does not exist at site with URL ‘
Lists/Client’. : at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay)
at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryRetry(ClientRuntimeContext clientContext, Int32 retryCount, Int32 delay)
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectListInstance.CreateList(Web web, ListInstance list, TokenParser parser, PnPMonitoredScope scope, Bo
olean isNoScriptSite)
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectListInstance.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, Provision
ingTemplateApplyingInformation applyingInformation) 1044ms af22d037-7a45-4a0b-a0aa-38b9a19dea2e
PowerShell_ISE.exe Information: 0 : 2017-02-06 21:13:48.5244 [List instances] [13] [Debug] Code execution scope ended 1047ms af22d037-7a45-4a0b-a0aa-38b9a19dea2e
PowerShell_ISE.exe Information: 0 : 2017-02-06 21:13:48.5259 [Provisioning] [13] [Debug] Code execution scope ended 12482ms af22d037-7a45-4a0b-a0aa-38b9a19dea2e
Apply-PnPProvisioningTemplate : List ‘Client’ does not exist at site with URL ‘Lists/Client’.
At line:1 char:1
+ Apply-PnPProvisioningTemplate -Web “clients/123456” -Path “C:Workspa …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: ([Apply-PnPProvisioningTemplate], ServerException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate
This series of posts will look at:
- Applying templates using a web service
- Removing external lists from the pnp template
- Creating external lists through CSOM within a web service