Get-PnPSiteTemplate -Out ---- Object reference not set to an instance of an object
We are using PSVersion 7.3.4. The below code works with PnP 1.11.0, but not with PnP 2.2.1. This is the only difference. The issue occurs for a more complex site Template; with a fast empty Template it works with any PnP version. Please fix asap, this prevents us from automatical SiteProvisioning that used to work earlier with an old version!!!
$url = "https://mycompany.sharepoint.com/sites/testsite" $templateUrl = "https://mycompany.sharepoint.com/sites/testsite/template" $templatePath = "D:\temp\template\template.xml" $clientid = "777777x7-x7x7-77xx-x777-77xxx77777x7" $clientSecret = "x7x7xxx.77xx~x~xxx.xxxxx.x77x~xxx" $con = Connect-PnPOnline -url $templateUrl -ClientId $clientid -ClientSecret $clientSecret -ReturnConnection Get-PnPSiteTemplate -Connection $con -Out $templatePath -PersistMultiLanguageResources -Force Get-PnPException
Message : Object reference not set to an instance of an object. Stacktrace : at PnP.PowerShell.Commands.Base.PnPConnectedCmdlet.ProcessRecord() in c:\build\src\Commands\Base\PnPConnectedCmdlet.cs:line 98 at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in c:\build\src\Commands\Base\PnPSharePointCmdlet.cs:line 120 at System.Management.Automation.CommandProcessor.ProcessRecord() ScriptLineNumber : 1
I'm also experiencing this issue. I do not know what part of the template is causing it due to the limited output.