Hey Nigel, I was thinking about this and went to read the issues on PnP-PowerShell GitHub. The replies, especially from Erwin seems to imply that lookup fields are double-parsed in the provisioning engine.
So I was suspicious of what I was doing, and went to check the XML template: Here’s the offending Lookup XML. <Field Type="Lookup" DisplayName="Campaign Name" Required="FALSE" EnforceUniqueValues="FALSE" List="{{listid:Report Request Form - Campaign Details}}" WebId="{1bd2b971-c571-4fd6-8145-a28c162b24a1}" ShowField="LinkTitleNoMenu" UnlimitedLengthInDocumentLibrary="FALSE" Group="Custom Admin Media Columns" ID="{51d58405-081b-4af6-8439-a7f6eca2b148}" SourceID="{1bd2b971-c571-4fd6-8145-a28c162b24a1}" StaticName="CampaignName" Name="CampaignName" /> See the WebID being a fixed guid. That seems to be the problem. It should be {{siteid}} <Field Type="Lookup" DisplayName="Campaign Name" Required="FALSE" EnforceUniqueValues="FALSE" List="{{listid:Report Request Form - Campaign Details}}" WebId="{{siteid}}" ShowField="LinkTitleNoMenu" UnlimitedLengthInDocumentLibrary="FALSE" Group="Custom Admin Media Columns" ID="{51d58405-081b-4af6-8439-a7f6eca2b148}" SourceID="{1bd2b971-c571-4fd6-8145-a28c162b24a1}" StaticName="CampaignName" Name="CampaignName" /> If the WebID is fixed – then the lookup will work for that web, but if we are taking the definitions to a separate site collection, that webid won’t be valid – I think that’s where our problems begin. I’m not sure the syntax, it should be {{siteid}}. Going to do some testing. But I saw the same issues with TaxonomyFieldTypeMulti <Field Type="TaxonomyFieldTypeMulti" DisplayName="Wiki Categories" StaticName="Wiki_x0020_Page_x0020_Categories" Name="Wiki_x0020_Page_x0020_Categories" ID="{e1a5b98c-dd71-426d-acb6-e478c7a5882f}" SourceID="{1bd2b971-c571-4fd6-8145-a28c162b24a1}" List="{{listid:TaxonomyHiddenList}}" WebId="{1bd2b971-c571-4fd6-8145-a28c162b24a1}" ShowField="Term1033" ShowInEditForm="TRUE" Mult="TRUE" Sortable="FALSE"> Anyway, I saw your later comment about crossing site collections and I think this is probably the key. jliu From: ozmoss-requ...@ozmoss.com<mailto:ozmoss-requ...@ozmoss.com> Sent: Friday, 10 March 2017 12:14 PM To: ozmoss@ozmoss.com<mailto:ozmoss@ozmoss.com> Subject: ozmoss Digest, Vol 74, Issue 6 Send ozmoss mailing list submissions to ozmoss@ozmoss.com To subscribe or unsubscribe via the World Wide Web, visit http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss or, via email, send a message with subject or body 'help' to ozmoss-requ...@ozmoss.com You can reach the person managing the list at ozmoss-ow...@ozmoss.com When replying, please edit your Subject line so it is more specific than "Re: Contents of ozmoss digest..." Today's Topics: 1. Re: ozmoss Digest, Vol 74, Issue 3 (Paul Noone) ---------------------------------------------------------------------- Message: 1 Date: Thu, 09 Mar 2017 20:59:44 +0000 From: Paul Noone <pano...@gmail.com> Subject: Re: ozmoss Digest, Vol 74, Issue 3 To: ozMOSS <ozmoss@ozmoss.com> Message-ID: <caj22gfwpe7ny_svrbyxadbfuxgy95whxrs4j4udousphv83...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Your practice sounds like good practice to me, Nigel. I usually deliver my code solutions via a pure CSOM console app. It's a little more work but I've had consistent success creating a standard list and then updating the settings as required. On Fri, 10 Mar 2017 at 5:33 am, Nigel Witherdin <nigel_wither...@hotmail.com> wrote: > Thanks sutha and John - I guess I have to play with it a bit more! > > It's frustrating as there are bugs listed as completed in the project from > a few years ago re: the engine needing to create lists used by lookup cols > prior to creating the fields. > > Maybe it's because my lookups are also site cols applied via content > types. Maybe I should change that design practice > > Sent from my iPhone > > On 9 Mar 2017, at 10:17 pm, John Liu <john-...@outlook.com> wrote: > > > > In my experience with PnP scripts ? it?s tricky with lookup lists. > > > > You want to do pretty much what you would do manually ? create list first, > then add the lookup, then add the site/list content type to that list. > > > > I find that I sometimes need to split the template into two pieces ? one > that creates lists with no content type. And Fields that points to those > lists. > > > > Then I run apply a second time to apply the entire template again ? and > since PnP provisioning template is additive, it gets the job done. > > > > But it?s a lot of trial and error. Makes me hate lookup fields a lot. > > > > jliu > > > > *From: *ozmoss-requ...@ozmoss.com > *Sent: *Wednesday, 8 March 2017 1:09 PM > *To: *ozmoss@ozmoss.com > *Subject: *ozmoss Digest, Vol 74, Issue 3 > > > > Send ozmoss mailing list submissions to > ozmoss@ozmoss.com > > To subscribe or unsubscribe via the World Wide Web, visit > http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss > or, via email, send a message with subject or body 'help' to > ozmoss-requ...@ozmoss.com > > You can reach the person managing the list at > ozmoss-ow...@ozmoss.com > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of ozmoss digest..." > > > Today's Topics: > > 1. PnP Provisioning Engine - Issue with Lookup Field > (Nigel Witherdin) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 8 Mar 2017 01:53:09 +0000 > From: Nigel Witherdin <nigel_wither...@hotmail.com> > Subject: PnP Provisioning Engine - Issue with Lookup Field > To: OzMoss <ozmoss@ozmoss.com> > Message-ID: > < > by2pr01mb175128a544c654455479d92c8f...@by2pr01mb1751.prod.exchangelabs.com > > > > Content-Type: text/plain; charset="iso-8859-1" > > 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 > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://prdlxvm0001.codify.net/pipermail/ozmoss/attachments/20170308/8abeefd3/attachment.html > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: pmo.xml > Type: text/xml > Size: 576123 bytes > Desc: pmo.xml > Url : > http://prdlxvm0001.codify.net/pipermail/ozmoss/attachments/20170308/8abeefd3/attachment.xml > > ------------------------------ > > _______________________________________________ > ozmoss mailing list > ozmoss@ozmoss.com > http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss > > > End of ozmoss Digest, Vol 74, Issue 3 > ************************************* > > > > _______________________________________________ > 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 > > _______________________________________________ > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://prdlxvm0001.codify.net/pipermail/ozmoss/attachments/20170309/5ee02ee3/attachment-0001.html ------------------------------ _______________________________________________ ozmoss mailing list ozmoss@ozmoss.com http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss End of ozmoss Digest, Vol 74, Issue 6 *************************************
_______________________________________________ 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