Problem in Deleting Remote Event Receiver in Sharepoint

Copper Contributor

Hi ,


I have attached Remote event Receiver to a document library using Provider hosted app.Now i am trying to delete (Provider hosted app) the same remote event Receiver  but i am getting "Microsoft.SharePoint.Client.ServerUnauthorizedAccessException: Access denied. You do not have permission to perform this action or access this resource." error.

Is there any other way apart from running powershell script to delete the attached remote event Receiver

8 Replies

You need to remove the remote event reciever using the same ClientID that created it. So if your provider hosted app with a specific clientid was used to create the event reciever you will get access denied if you try to delete it with powershell using your credentials. However i do believe that the pnp powershell Connect-SPOnline has some parameters to connect with clientid and secret. You should be able to delete it then

I do

You can do this first by searching it in the SharePoint ClientBrowser and then use a powershell script to delete it.

function Get-SPOListEventreceivers
param (

  $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
  $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)

} catch [Net.WebException] 
            Write-Host $Url " failed to connect to the site" $_.Exception.Message.ToString() -ForegroundColor Red


 Write-Host "Found " $recevery.Count " receivers in " $lista.Title


Write-Host "receiver removed"

 catch [Net.WebException] 
  Write-Host "Failed to delete the receiver" $_.Exception.Message.ToString() -ForegroundColor Red


# Paths to SDK. Please verify location on your computer.
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll" 
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" 

# Insert the credentials and the name of the admin site
$password = "$xxxx" 
$url = ""
$AdminPassword=Read-Host -Prompt "Password" -AsSecureString
$ListTitle="Project Metadata"

Get-SPOListEventreceivers -Username $Username -AdminPassword $AdminPassword -Url $Url -ListTitle $ListTitle -EventReceiverGUID $EventreceiverGUID

yeah i think now powershell is the only option .

Because the issue was not with the appid change but the farm id change because of which the entire AppId was not matching and hence giving access denied error.


Thanks for replies :)

Powershell method gives access denied error. Is there any way we can deleted the event receiver without deleting the list

@Prerak DesaiI am facing the exact same issue.. unable to remove the RER using PnP either

@john john 


Hi john may I know if you are using sharepoint online version or on premise version??



As  RER can be removed by the app that registered it. In our scenario farm realm id got changed because of which even the same app was not able to delete the remote event receiver.


In order to get rid of the remote event receiver we used brute force . Instead of client side code we wrote server side PowerShell script to delete the  remote event receiver which worked for us.




@bhartisemwal1990 Thanks, We were facing the same issue. Your suggestion helped

Unfortunately, at the moment it is impossible to remove the remote event receiver that are added. An error «Access Denied» occurs. The only way is to delete the list. Receivers, written by published service (in Azure) can be removed properly