PnP PowerShell Apply-ProvisioningTemplate error : Sequence contains more than one matching element

Copper Contributor

Can someone look at the template and advise why I'm getting this strange message.

 

The template was created using the Get-SPOProvisioningTemplate powershell command, the error I get is during the execution of Apply-SPOProvisioningTemplate.

 

 

I got this message on the original template and after stripping out more than half of it, I'm still getting the error.

 

I'm attaching the verbose logging (apply_result.txt) and the original template and the stripped down template

(I just renamed the pnp files for easier identification, the original name was "template2.pnp")

 

Appreciate any insights!

 

Thank you,

Jan

2 Replies

@Jan Vorster, I can't see any attachments.

 

I'm assuming that you use Set-SPOTraceLog. Could you copy the last 10 lines or so in this post.

 

 

Apologies - it seems like the selected files don't get attached when I click "Post"... I'll zip them together.

 

Herewith the output of the Apply-SPOProvisioningTemplate command:

 

PS C:\temp\sopt> Apply-SPOProvisioningTemplate -Path template2.pnp > apply_result.txt
powershell.exe Information: 0 : 2016-10-27 15:28:27.2777 [OfficeDevPnP.Core] [0] [Information] File template2.pnp retrieved from folder 0ms
powershell.exe Information: 0 : 2016-10-27 15:28:27.2798 [OfficeDevPnP.Core] [0] [Information] File template2.pnp retrieved from folder 0ms
powershell.exe Information: 0 : 2016-10-27 15:28:27.3138 [OfficeDevPnP.Core] [0] [Information] File template2.xml retrieved from folder 0ms
powershell.exe Information: 0 : 2016-10-27 15:28:27.3308 [Provisioning] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:27.3318 [Provisioning] [7] [Information] ProgressDelegate registered 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:27.3328 [Provisioning] [7] [Information] MessagesDelegate registered 1ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:35.2850 [Extensibility Providers] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:35.2870 [Extensibility Providers] [7] [Debug] Code execution scope ended 1ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:35.7122 [Regional Settings] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:36.1122 [Regional Settings] [7] [Debug] Code execution scope ended 400ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:36.1458 [Supported UI Languages] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:37.0531 [Supported UI Languages] [7] [Debug] Code execution scope ended 906ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:37.0630 [Features] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:37.6441 [Features] [7] [Debug] Code execution scope ended 580ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:37.6532 [List instances] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:39.1894 [List instances] [7] [Debug] Updating list Project Risks Issues Log 1536ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:40.8540 [List instances] [7] [Debug] Creating view All Items 3200ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:42.8749 [List instances] [7] [Debug] Code execution scope ended 5221ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:42.8769 [Lookup Fields] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:55.9791 [Lookup Fields] [7] [Debug] Code execution scope ended 13101ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:55.9885 [Pages] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:28:58.1082 [Pages] [7] [Debug] Overwriting existing page /sites/pnptemplatesite1/site1111/SitePages/Home.aspx 2119ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Error: 0 : 2016-10-27 15:28:58.6175 [Pages] [7] [Error] Overwriting existing page /sites/pnptemplatesite1/site1111/SitePages/Home.aspx failed: The item that you are trying to delete is the current welcome page and cannot be deleted. : at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb)
at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
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.ObjectPages.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation) 2628ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:29:00.5284 [Pages] [7] [Debug] Code execution scope ended 4539ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:29:00.5394 [Publishing] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:29:04.6417 [Publishing] [7] [Debug] Code execution scope ended 4101ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:29:04.6597 [Property bag entries] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:29:10.3504 [Property bag entries] [7] [Debug] Code execution scope ended 5690ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:29:10.3865 [Web Settings] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:29:11.8833 [Web Settings] [7] [Debug] Code execution scope ended 1496ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:29:12.3646 [Navigation] [7] [Debug] Code execution scope started 0ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:29:19.7632 [Navigation] [7] [Debug] Code execution scope ended 7397ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
powershell.exe Information: 0 : 2016-10-27 15:29:19.7642 [Provisioning] [7] [Debug] Code execution scope ended 52432ms 5fb0f8aa-05f6-4115-a601-59aae2a84f69
Apply-SPOProvisioningTemplate : Sequence contains more than one matching element
At line:1 char:1
+ Apply-SPOProvisioningTemplate -Path template2.pnp > apply_result.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Apply-SPOProvisioningTemplate], InvalidOperationException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate