Forum Discussion
ApplyProvisioningTemplate doesn't have token {listid: Project Team} in token list.
Hi any help is greatly apprecaited, I am struggling with what I thought were simple operations. Save off PNP 2/10/2017 xml from site collection A, manually via UI create site collection B using STS template, then apply template A onto Site collection B.
This site collection on A includes a few lists and some fields. Saving off the template puts token's in the xml for later replacement E.g. "{listid:Project Team}". When I run the ApplyProvisioningTemplate, it creates a list of all the tokens from the destination site B and replaces token's in the template xml (via ParseString in TokenParser.cs) with tokens from the destination site B which doesn't have all the lists created yet so it throws an exception saying that it's invalid XML because it still has the tokens. I must fundamentally be missing something given I thought the whole purpose of the template was to recreate an A like site on B. When I create the list Project Team manually on site collection B and run ApplyProvisioningTemplate it is able to find the token and continue on. Seems like creating the skeleton List first is necessary so that the token list can have the new content from A. The handler that creates the Lists isn't run until after Field processing. Am I missing steps other than Get tempate, create site creation put back template?
5 Replies
- paulpaschaBronze Contributor
You're not missing anything. What you describe should just work. There seems to be something wrong in the order elements in the Provisioning Template (your XML) are processed.
Can you share your template so I can have a quick look?
- Jonathan LoweCopper Contributor
Hi Paul,
I will need to scrub the xml and verify it's ok to send but I'll try.
What elements set the order that you mention? I've seen that within a gouping E.g. Site Groups order matters and that they aren't always written out in an order that will work with sequential play back.
In ApplyRemoteTemplate the handlers are added Fields first then Content Type, then List. Seems like the list skeleton (with just a title) should be created first to get an ID for putting back when creating a Field.
- paulpaschaBronze Contributor
From your description I understand there are Lookup fields in the play? Lookup fields need special attention because of the reasons you are describing. PnP should support Lookup Fields and special handling was implemented. There was an issue submitted in PnP earlier around the provisioning of lookup fields, see the link below.
https://github.com/SharePoint/PnP/issues/906
Are you using the latest version of PnP Core? If so the issue seems to be still there albeit currently closed in PnP. I think it really helps to share your template or a scubbed version of it that fails in order to be able to fix this.