Trouble creating/importing site template #2507
Replies: 3 comments 3 replies
-
Bump |
Beta Was this translation helpful? Give feedback.
-
Try and enable trace log in the session you are running the script in, and see if it gives any hints.
You can also try and seperate columns and content types in seperate invokes with seperate handlers to ensure this isnt race conditions (another way to test that is to re-run the template, and see if it finishes, as the cmdlets are idempotent) |
Beta Was this translation helpful? Give feedback.
-
Is there a reason why you are not using tenant templates? You wouldn't need to necessarily create the site first; you could do it all from the invoke. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently trying to provision a site using a template1.xml file which is generated from a template site using the command:
Get-PnPSiteTemplate -Force -Out template1.xml
From here we are then creating our new site using:
New-PnPSite -Type TeamSiteWithoutMicrosoft365Group -Title $Title -Url $SiteURL
(The type is the same as our template site)
The script will then connect to the site:
Connect-PnPOnline -URL $SiteURL -Interactive
After connecting, the script will begin to invoke the previously generated template1.xml file onto our new site.
Invoke-PnPSiteTemplate -Path template1.xml
This is where we are running into issues. The script then throws up the following error:

We have taken a look into the generated template1.xml file to see if the file contains the column which the script says does not exist and we are able to find it here:
Field Type="Choice" DisplayName="TK Style" Required="FALSE" EnforceUniqueValues="FALSE" Indexed="FALSE" Format="Dropdown" FillInChoice="FALSE" Group="TK Columns" ID="{70d06a52-31c2-4ba7-b360-b4e18b579273}" SourceID="{3c25c9b6-2bc1-461a-83fb-d84101990711}" StaticName="TK_x0020_Style" Name="TK_x0020_Style"
CHOICES
CHOICE>Style A</CHOICE
CHOICE>Style B</CHOICE
CHOICE>Style C</CHOICE
We have also looked on the site we are using as a template to make sure that the column definitely exists, and we are able to find it where we expected listed under a content type:

We then looked on our generated site and also found it created there under the same content type as our template site.

I would appreciate any guidance on resolving this issue.
Beta Was this translation helpful? Give feedback.
All reactions