Problem
On on-premises SharePoint 2013 there was a web site where there were hundreds of pending access requests that needed to be removed. Approving or Declining requests was not desired, they just needed to be removed without any email being sent to the users.There is no deletion option in browser UI, and after adding traditional AllItems.aspx view using SharePoint Designer, deleting requests one by one would’ve taken very long time, as while the All Items view allowed me to select multiple rows, there was no Delete button in any toolbar nor ribbon.
Solution
Simple PowerShell script did the trick.NOTE! This also removes the history, so only run it if you do not wish to persist the access request history for the site.
$web = Get-SPWeb https://teamsites.company.com/teams/teamsiteA
$items = $web.Lists["Access Requests"].Items
while($items.Count -gt 0)
{
Write-Host "Deleting: $($items[0].Title)"
$items[0].Delete()
}
No comments:
Post a Comment