ApplyProvisioningTemplate doesn't have token {listid: Project Team} in token list.

%3CLINGO-SUB%20id%3D%22lingo-sub-49034%22%20slang%3D%22en-US%22%3EApplyProvisioningTemplate%20doesn't%20have%20token%20%7Blistid%3A%20Project%20Team%7D%20in%20token%20list.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49034%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20any%20help%20is%20greatly%20apprecaited%2C%20I%20am%20struggling%20with%20what%20I%20thought%20were%26nbsp%3Bsimple%20operations.%26nbsp%3B%20Save%20off%20PNP%202%2F10%2F2017%26nbsp%3Bxml%26nbsp%3Bfrom%20site%20collection%20A%2C%20manually%20via%20UI%20create%20site%20collection%20B%20using%20STS%20template%2C%20then%20apply%20template%20A%20onto%20Site%20collection%20B.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3BThis%20site%20collection%20on%20A%20includes%20a%20few%20lists%20and%20some%20fields.%26nbsp%3B%20Saving%20off%20the%20template%20puts%20token's%20in%20the%20xml%20for%20later%20replacement%26nbsp%3BE.g.%20%22%7Blistid%3AProject%20Team%7D%22.%26nbsp%3B%20When%20I%20run%20the%20ApplyProvisioningTemplate%2C%20it%20creates%20a%20list%20of%20all%20the%20tokens%20from%20the%20destination%20site%20B%20and%20replaces%20token's%20in%20the%20template%20xml%20(via%20ParseString%20in%20TokenParser.cs)%26nbsp%3Bwith%20tokens%20from%20the%20destination%20site%20B%20which%20doesn't%20have%20all%20the%20lists%20created%20yet%20so%20it%20throws%20an%20exception%20saying%20that%20it's%20invalid%20XML%20because%20it%20still%20has%20the%20tokens.%26nbsp%3B%20I%20must%20fundamentally%20be%20missing%20something%20given%20I%20thought%20the%20whole%20purpose%20of%20the%20template%20was%20to%20recreate%20an%20A%20like%20site%20on%20B.%26nbsp%3B%20When%20I%20create%20the%20list%20Project%20Team%20manually%20on%20site%20collection%20B%20and%20run%26nbsp%3BApplyProvisioningTemplate%26nbsp%3Bit%20is%20able%20to%20find%20the%20token%20and%20continue%20on.%26nbsp%3B%26nbsp%3BSeems%20like%20creating%20the%20skeleton%20List%20first%20is%20necessary%20so%20that%20the%20token%20list%20can%20have%20the%20new%20content%20from%20A.%26nbsp%3B%20The%20handler%20that%20creates%20the%20Lists%20isn't%20run%20until%20after%20Field%20processing.%26nbsp%3B%20Am%20I%20missing%20steps%20other%20than%20Get%20tempate%2C%20create%20site%20creation%20put%20back%20template%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49237%22%20slang%3D%22en-US%22%3ERe%3A%20ApplyProvisioningTemplate%20doesn't%20have%20token%20%7Blistid%3A%20Project%20Team%7D%20in%20token%20list.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49237%22%20slang%3D%22en-US%22%3E%3CP%3EOk%20I%20think%20I%20know%20what%20happened.%26nbsp%3B%20If%20you%20have%20a%20field%20like%20Paul%20pointed%20out%20lookup%20in%20site%20column%2C%20it%20will%20create%20the%20field.%26nbsp%3B%20If%20you%20crash%20later%20on%20in%20the%20ApplyProvisioningTemplate%20process%20and%20rerun%20(which%20I%20did%20because%20we%20had%20an%20issue%20with%20a%20non%20existant%20item)%20prior%20to%20the%20list%20being%20created%26nbsp%3Bthen%20the%20check%20for%20existing%20field%20IDs%20will%20be%20true%20and%20you'll%20try%20to%20update%20the%20field%20instead%20of%20create.%26nbsp%3B%20In%20that%20case%20given%20the%20list%20hasn't%20been%20created%20it'll%20still%20have%20%7Blistid.%7D%20and%20will%20fail%20the%20xml%20syntax%20check.%26nbsp%3B%20Not%20ideal%20but%20it%20makes%20sense%20now.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20the%20help%20Paul%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49207%22%20slang%3D%22en-US%22%3ERe%3A%20ApplyProvisioningTemplate%20doesn't%20have%20token%20%7Blistid%3A%20Project%20Team%7D%20in%20token%20list.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49207%22%20slang%3D%22en-US%22%3E%3CP%3EThat%20discription%20from%20github%20is%20right%20on%20the%20money.%26nbsp%3B%20I'm%20trying%20to%20make%20a%20site%20that%20I%20can%20download%20the%20xml%20that%20will%20reproduce%20should%20have%20that%20soon.%26nbsp%3B%20I'm%20using%20the%202%2F10%2F2017%20release.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49206%22%20slang%3D%22en-US%22%3ERe%3A%20ApplyProvisioningTemplate%20doesn't%20have%20token%20%7Blistid%3A%20Project%20Team%7D%20in%20token%20list.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49206%22%20slang%3D%22en-US%22%3E%3CP%3EFrom%20your%20description%20I%20understand%20there%20are%20Lookup%20fields%20in%20the%20play%3F%20Lookup%20fields%20need%20special%20attention%20because%20of%20the%20reasons%20you%20are%20describing.%20PnP%20should%20support%20Lookup%20Fields%20and%20special%20handling%20was%20implemented.%20There%20was%20an%20issue%20submitted%20in%20PnP%20earlier%26nbsp%3Baround%20the%20provisioning%20of%20lookup%20fields%2C%20see%20the%20link%20below.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FSharePoint%2FPnP%2Fissues%2F906%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FSharePoint%2FPnP%2Fissues%2F906%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAre%20you%20using%20the%20latest%20version%20of%20PnP%20Core%3F%20If%20so%20the%20issue%20seems%20to%20be%20still%20there%20albeit%20currently%20closed%20in%20PnP.%20I%20think%20it%20really%20helps%20to%20share%20your%20template%20or%20a%20scubbed%20version%20of%20it%20that%20fails%20in%20order%20to%20be%20able%20to%20fix%20this.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49161%22%20slang%3D%22en-US%22%3ERe%3A%20ApplyProvisioningTemplate%20doesn't%20have%20token%20%7Blistid%3A%20Project%20Team%7D%20in%20token%20list.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49161%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Paul%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20will%20need%20to%20scrub%20the%20xml%20and%20verify%20it's%20ok%20to%20send%20but%20I'll%20try.%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20elements%20set%20the%20order%20that%20you%20mention%3F%26nbsp%3B%20I've%20seen%20that%20within%20a%20gouping%20E.g.%20Site%20Groups%20order%20matters%20and%20that%20they%20aren't%20always%20written%20out%20in%20an%20order%20that%20will%20work%20with%20sequential%20play%20back.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20ApplyRemoteTemplate%20the%20handlers%20are%20added%20Fields%20first%20then%20Content%20Type%2C%20then%20List.%26nbsp%3BSeems%20like%20the%20list%20skeleton%20(with%20just%20a%20title)%20should%20be%20created%20first%20to%20get%20an%20ID%20for%20putting%20back%20when%20creating%20a%20Field.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49058%22%20slang%3D%22en-US%22%3ERe%3A%20ApplyProvisioningTemplate%20doesn't%20have%20token%20%7Blistid%3A%20Project%20Team%7D%20in%20token%20list.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49058%22%20slang%3D%22en-US%22%3E%3CP%3EYou're%20not%20missing%20anything.%20What%20you%20describe%20should%20just%20work.%20There%20seems%20to%20be%20something%20wrong%20in%20the%20order%20elements%20in%20the%20Provisioning%20Template%20(your%20XML)%20are%20processed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20share%20your%20template%20so%20I%20can%20have%20a%20quick%20look%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

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

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?

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. 

 

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. 

That discription from github is right on the money.  I'm trying to make a site that I can download the xml that will reproduce should have that soon.  I'm using the 2/10/2017 release.     

Ok I think I know what happened.  If you have a field like Paul pointed out lookup in site column, it will create the field.  If you crash later on in the ApplyProvisioningTemplate process and rerun (which I did because we had an issue with a non existant item) prior to the list being created then the check for existing field IDs will be true and you'll try to update the field instead of create.  In that case given the list hasn't been created it'll still have {listid.} and will fail the xml syntax check.  Not ideal but it makes sense now.

 

Thanks for the help Paul