Does Applying a SharePoint Provisioning Template Delete Documents?
Question details
The user wants to know if applying a provisioning template using Invoke-PnPSiteTemplate in PnP PowerShell will automatically delete existing documents in a SharePoint site library.

- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Applying a PnP PowerShell provisioning template to an existing live SharePoint site.
- Observed behavior
- The user is looking for confirmation on the safety of their existing document library contents during a template provisioning process.
Before applying any provisioning template to a live site, manually back up the destination SharePoint site and review the XML template for any explicit document or list deletion operations.
Safely Test and Apply SharePoint Provisioning Templates
Verify the template's behavior in a non-production sandbox environment to ensure existing documents are not affected before applying it to your production site.
Applying a PnP PowerShell provisioning template with the Invoke-PnPSiteTemplate command generally updates configured site elements but does not delete existing document library contents automatically. However, variations in template configurations and PnP PowerShell versions can cause unexpected changes.
Open your provisioning template XML file in a code editor. Search through the <pnp:Lists> and <pnp:Files> sections to ensure there are no instructions that overwrite or remove existing document libraries.
Navigate to your SharePoint admin center and create a new, non-production test site that mimics the structure and content of your live destination site.
Open PnP PowerShell, connect to your test site using 'Connect-PnPOnline', and execute the 'Invoke-PnPSiteTemplate -Path yourtemplate.xml' command.
After the script completes, open the document libraries in your test site via the SharePoint web interface to confirm that all pre-existing documents remain intact and accessible.

Manage Your SharePoint Documents Offline with WPS Office
While SharePoint and PnP PowerShell handle online site configuration, you still need a reliable local software suite to open and edit your downloaded files. WPS Office is a lightweight, highly compatible alternative to Microsoft Office that allows you to manage Word, Excel, and PowerPoint files effortlessly and for free.
- 1. Download the Installer: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install WPS Office: Run the setup file and follow the quick on-screen instructions to install the suite on your computer.
- 3. Edit Your Documents: Launch WPS Office and open your SharePoint-downloaded documents to begin editing them securely offline.

Frequently Asked Questions
Can I reverse a SharePoint provisioning template once it is applied?
No, applying a provisioning template via PnP PowerShell cannot be automatically reversed. You would need to manually revert the changes made by the template or restore the site from a previous backup.
Does Invoke-PnPSiteTemplate overwrite existing lists and libraries?
It typically updates existing lists by adding missing columns, content types, or views. However, if the template enforces a strict schema that conflicts with the existing list, it might modify existing settings, which is why testing is crucial.
Where can I find help for specific PnP PowerShell template errors?
The best resources for troubleshooting PnP PowerShell errors are the official Microsoft Q&A platform, the PnP PowerShell GitHub repository, and the broader Microsoft 365 developer community.




