As the title say, how to remove a applied PnPProvisioningTemplate with PowerShell?
I have tried Remove-PnPCustomAction on all "Custom Action's Name attribute" but it does not work after running this script.
I used this example: https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-lists-and-libraries and the "Custom Tab" Ribbon example.
This module: SharePointPnPPowerShellOnline
# Connect to a previously created Modern Site
$cred = Get-Credential;
Connect-PnPOnline -Url https://[tenant].sharepoint.com/sites/dev/ -Credentials $cred;
Write-Host "Connected to SharePoint!";
$scriptPath = "$($PSScriptRoot)\custom_action.xml";
Write-host "Running script: $($scriptPath)";
# Apply the PnP provisioning template
#Apply-PnPProvisioningTemplate -Path $scriptPath -Handlers CustomActions;
#Write-host "Applied custom action!";
$test = Get-PnPCustomAction;
Write-Host $test;
#Remove-PnPCustomAction -Identity CA_4 -Force
#Write-Host "Removed custom Action"
Thank you.
PnP Provisioning engine does only set API configurations on the site and uploads possibly assets. There's no actual "template" as such, which you can remove from the site, but you can absolutely remove the configurations which were applied to the template.
Removing, for example, UserCustomAction configuration is dependent on what you did have in the actual template. In the example case CustomActions where applied on the SiteCollection level, so you'll need to remember to use Scope parameter correctly. See documentation from https://learn.microsoft.com/en-us/powershell/module/sharepoint-pnp/Remove-PnPCustomAction?view=sharepoint-ps