Jun 22 2017 03:52 PM
Jun 22 2017 03:52 PM
We connect to our customer tenant and get a .pnp file without errors:
$tenant = "ourcustomertenant"; $sourceSite = "/sites/ClientesNotaCredito"; $webUrl = "https://{0}.sharepoint.com{1}/" -f $tenant, $sourceSite; $path = "C:\Templates\HumaxTemplate.pnp" Write-Output $("Connecting to {0}..." -f $webUrl); Connect-PnPOnline -Url $webUrl -Credentials WCMStoredCredentials; Write-Output "Context obtained"; Write-Output "Creating PnP template..."; Get-PnPProvisioningTemplate -Out $path Write-Output $("Template saved to {0}" –f $path);
Then we connect to our tenant, to replicate the environment, and we created a site collection with the same publishing template and execute this:
# Define variables $tenant = "ourowntenant"; $targetSite = "/sites/DevHumax"; $path = "C:\Templates\HumaxTemplate1.pnp"; $siteTitle = "My Target Site"; $siteDescription = " "; $siteUrl = "ourowntenant.sharepoint.com"; # Get context $webUrl = "https://{0}.sharepoint.com/{1}" -f $tenant, $targetSite; Write-Output $("Connecting to {0}..." -f $webUrl); Connect-SPOnline -Url $webUrl -Credentials WCMStoredCredentials; Write-Output "Done"; # Create new subsite $web = Get-PnPWeb -Identity /sites/DevHumax # New-SPOWeb -Title "$siteTitle" -Url "$siteUrl" -Description "$siteDescription" -Locale 1043 -Template "STS#1" # Apply template Write-Output $("Applying PnP template [{0}] to site [{1} ({2})]..." -f $path, $web.Title, $web.Url); Apply-PnPProvisioningTemplate $path; Write-Output "Done";
However we get this error:
Apply-PnPProvisioningTemplate : The Provisioning Template URI HumaxTemplate1.xml is not valid. At line:2 char:1 + Apply-PnPProvisioningTemplate $path; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], ApplicationException + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplate
Nov 15 2017 06:26 AM
Did you find a solution? I have the same error.
Apr 10 2018 01:03 AM
I am also facing the same error, did you find any solution?
Mar 06 2019 02:09 AM
I had the same problem... I think the problem was you changed the filename of the pnp-template. You created a template as humaxtemplate.pnp, then I guess you changed the pnp-File to humaxtemplate1.pnp, then the applying-process fails.