Issues with the "Fields" Handler and Get-PnPSiteTemplate #4628
-
Wondering if anyone else has encountered a similar issue or might know what the issue is ... I am using Get-PnPSIteTemplate to extract templates files for various site components from an existing M365 SharePoint site. The site was created using a standard M365 Team Site Template (this is NOT a TEAMS-connected site). I am using PowerShell v7.4.5 with the PnP.PowerShell module v2.99.35-nightly (so relatively recent) Using Get-PnPSiteTemplate I can extract XML template files for the majority of the handlers we need. For example, all of the following handlers (and several others) work fine:
The one handler that does not seem to work is the "Fields" handler (which we have used successfully in the past with earlier versions of PowerShell and PnP.PowersShell, both on-prem and with SPO). Currently when I run the extract for the Fields handler as shown below
the cmdlet begins to run and then seems to begin 'extracting', but then stops almost immediately after. I get the following output on the command line: PS C:\Temp> Get-PnPSiteTemplate -Out "C:\Temp\Template\Template-2-SPFIELD.xml" -Handlers $handlers -ErrorAction Continue -Verbose In the Debug log file that is generated there is nothing that offers any clues as to what the issue might be ... pwsh Information: 0 : 2024-12-09 18:14:45.9192 [GetContextAsync] [0] [Debug] Authentication type: AzureADCertificate for scopes https://tenant.sharepoint.com/.default 0ms Anyone else used the Fields handler successfully? Ideas as to why this is not working? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
I tried your command and get no errors. |
Beta Was this translation helpful? Give feedback.
-
Hi, Thanks for responding ... yes, I believe all the relevant permissions have been granted. There are some taxonomy fields but the app has those necessary permissions as well When I run the cmdlet (after connecting) I just get this output: Get-PnPSiteTemplate: Object reference not set to an instance of an object. Any ideas how to get more details? The only thing that shows up in the log file is: powershell_ise.exe Information: 0 : 2024-12-11 10:58:59.5264 [Site Security] [19] [Debug] Processing Role Assignment Microsoft.SharePoint.Client.RoleAssignment 772ms d0bff343-f822-4ca0-aa1f-88864a38a900 |
Beta Was this translation helpful? Give feedback.
-
This is how I set up the connection Connect-PnPOnline -Url "https://xxxxxxx.sharepoint.com/sites/KEEPitTemplateSiteRel2.0" -ClientId $clientId -Tenant $tenantId -CertificatePath $certPath -CertificatePassword $certPassword Let me confirm all the variables are set correctly. Thanks for your responses! |
Beta Was this translation helpful? Give feedback.
I tried your command and get no errors.
Do you have all required application permissions granted for your Azure AD app?
Do you have taxonomy fields in your site? Maybe need termstore permissions?