Hi Nigel,
I got few wired error with cmdlets. I gave up and did with .exe. Technically I dont see any reason. but worked after using .exe. Thats seems less pain. Here is my code. static void Main(string[] args) { OfficeDevPnP.Core.AuthenticationManager authMgr = new OfficeDevPnP.Core.AuthenticationManager(); string siteURL = "https://charterhall.sharepoint.com/masked"; string userName = ""; Console.WriteLine("Please Enter password"); string password = Console.ReadLine(); Console.WriteLine("The Shed Site Build"); Console.WriteLine("Please Enter reset for Reset the site"); string input = Console.ReadLine(); if(string.Equals(input.ToUpper(),"RESET")) { using (var ctx = authMgr.GetSharePointOnlineAuthenticatedContextTenant(siteURL, userName, password)) { ResetSite(ctx); } } string file = "ProvisioningTemplate.xml"; string directory = "C:\\Projects\\source\\SharePoihnt\\TheShed\\Charterhall.Shed\\ShedCTProvisioning\\Template"; var provisioningProvider = new XMLFileSystemTemplateProvider(directory, string.Empty); var provisioningTemplate = provisioningProvider.GetTemplate(file); provisioningTemplate.Connector.Parameters[FileConnectorBase.CONNECTIONSTRING] = directory; using (var ctx = authMgr.GetSharePointOnlineAuthenticatedContextTenant(siteURL, userName, password)) { ctx.Load(ctx.Web); ctx.ExecuteQueryRetry(); ctx.Web.ApplyProvisioningTemplate(provisioningTemplate); ctx.ExecuteQueryRetry(); System.Console.WriteLine(ctx.Web.Title); System.Console.WriteLine("Site Column and Content Types are created"); SP_Helper.CreateList(ctx, "Property", "prp", "List of Sheds", "0x0100928AB37347CC8B4EAEFCCB8A4F833501",Constants.viewFields.Property); ***Removed // media library ***Removed. System.Console.WriteLine("Lists and Library are created."); System.Console.WriteLine("Press any key to quit."); } // System.Console.ReadLine(); } Sutha. ________________________________ From: ozmoss-boun...@ozmoss.com <ozmoss-boun...@ozmoss.com> on behalf of Nigel Witherdin <nigel_wither...@hotmail.com> Sent: Wednesday, 8 March 2017 12:53 PM To: OzMoss Subject: PnP Provisioning Engine - Issue with Lookup Field Hi All, 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
_______________________________________________ Sponsored by Infotext - Amazing Search for Microsoft SharePoint - http://www.infotext.com/ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss