When using Get-PnPSiteTemplate and Invoke-PnPSiteTemplate to export and import SharePoint sites, the preservation of the values in People/Group fields can sometimes be problematic. This is due to how these fields are handled during the export and import process. Here are a few suggestions to help you preserve the settings for the People/Group field linked to a SharePoint group:
- Check Template Options: Ensure that when you are exporting the site template, you are including all necessary options that pertain to the People/Group fields. Sometimes, specific parameters may need to be set to ensure that group memberships are preserved.
- Post-Import Configuration: After importing the site template, you might need to manually set the People/Group field to link to the correct SharePoint group. This can be done using PowerShell scripts that specifically update the field after the template has been applied.
- Use PnP PowerShell: Consider using additional PnP PowerShell commands to manage the group memberships directly after the import. Commands like
Set-PnPListItemcan be useful to update the specific field values after the site template has been applied. - Review Permissions: Ensure that the account you are using has the necessary permissions to modify the People/Group fields and that the group exists in the destination site.
- Consult Documentation: Review the official documentation for any updates or notes regarding the handling of People/Group fields during site template operations. There may be specific nuances or known issues documented that could provide further insight.
By following these steps, you should be able to better manage the preservation of the People/Group field settings when exporting and importing your SharePoint site templates.