Mar 07 2017 06:06 PM
Having an issue trying to use the PnP Provisioning Engine PowerShell cmdlets to template a site that contains Lookup columns. The site is an O365 site, and the commands I am using are:
Connect-SPOnline "https://scentregroup.sharepoint.com/sites/scgpmo" Get-PnPProvisioningTemplate -Out c:\temp\pmo.xml -PersistBrandingFiles -Handlers Lists, ContentTypes, Fields, Files, Navigation, Pages, RegionalSettings, SiteSecurity, TermGroups, Workflows Connect-SPOnline "https://scentregroup.sharepoint.com/sites/pmo_trial" Apply-PnPProvisioningTemplate -Path c:\temp\pmo.xml -Handlers Lists, ContentTypes, Fields, Files, Navigation, Pages, RegionalSettings, SiteSecurity, TermGroups, Workflows
The "Apply-PnPProvisioningTemplate" fails with the error:
Apply-PnPProvisioningTemplate : The field was found invalid: {{listid:PriorLookUpStratAlign1}
I believe the line in the pmo.xml file that is causing the issue is the first (of a few) lookup fields. I understand that the engine is using a token to represent the list id, which should be replaced with an actual list id when the list on the new site is actually created
<Field Type="Lookup" DisplayName="SCG_PMO_PriorityStrategicAlignment:Score1" List="{{listid:PriorLookUpStratAlign1}}" WebId="df9b6d5e-4f8b-4abe-99f9-1776e3928e22" ShowField="Score1" FieldRef="b1b6ed05-a2e1-4699-b3c8-12a1838c44ef" UnlimitedLengthInDocumentLibrary="FALSE" Group="SCG PMO" ID="{656200e0-d1ad-44f8-8c1a-e83a433f46b1}" SourceID="{df9b6d5e-4f8b-4abe-99f9-1776e3928e22}" StaticName="SCG_PMO_PriorityStrategicAlignment_x003a_Score1" Name="SCG_PMO_PriorityStrategicAlignment_x003A_Score1" ReadOnly="TRUE" />
Dont really understand why the "WebId" parameter is not also using some sort of token replacement logic?
Has anyone used the engine to template sites including lookup fields? If so, can you offer any advice as to where I am going wrong?
I have also attached the full pmo.xml file in case that helps
Thanks!
Nigel
Mar 07 2017 06:09 PM
I should mention that I am using the Feb 2017 release of the PnP PowerShell Online MSI (SharePointPnPPowerShellOnline.msi)
Thanks again!
Mar 07 2017 11:26 PM - edited Mar 07 2017 11:40 PM
I think the problem here is that the Field is being created without the List the lookup is referencing being available. There have been issues around this in the past, see the following issue in PnP repo for example:
https://github.com/SharePoint/PnP/issues/906
There seem to be more issues popping up recently around lookup fields. There is also this conversation describing the same issue:
I did some testing and I am able to reproduce your issue. I did the following basic steps
I've submitted an issue in PnP here:
Mar 10 2017 05:19 PM
Thanks for the reply Paul - lets see what happens.