Tuesday, March 15, 2016

Remove all custom user action

On my current project I use the PnP framework provisioning to add custom user action to my web. The web gets quickly fell up the custom user action weird places and it is hard to see which of the custom user action is the latest and therefore the ones I should test. Therefore, I use this PowerShell snippet to delete all, before I re-run my provisioning.

$web = get-spweb https://apps.dev2.net/sites/dev1/
$customActionIds = $web.UserCustomActions | select id
$customActionIds | % {
  $web.UserCustomActions.Item($_.Id).Delete()
}