
Hi @GURUNATHAN MARIAPPAN ,
In a typical Full Trust Code (FTC) / Farm Solution scenario, Event Receivers and List Event Receivers were created with the SharePoint
Server Side Object Model code and deployed via Solutions. In this scenario, the event receiver code runs on the SharePoint server.
You can use following script to check get all event receivers attached with a List:
#Get the web
$Web = Get-SPWeb "https://sharepoint.crescent.com"
#Get the Target List
$List = $Web.Lists["Documents"]
#Retrieve all event receivers associated with the list
$List.EventReceivers | Select Id, Type, Assembly, Class | FL
You can add event receivers by following script
#Get the web
$Web = Get-SPWeb "https://sharepoint.crescent.com"
#Get the Target List
$List = $Web.Lists["Documents"]
#Retrieve all event receivers associated with the list
#$List.EventReceivers | Select Id, Type, Assembly, Class | FL
$Assembly = "Crescent.DocRestrict, Version=1.0.0.0, Culture=neutral, PublicKeyToken=677b45b1314c252c"
$Class= "Crescent.Utilities.DocRestrict.Restrict"
Write-Host "Attaching Event Receiver..."
$list.EventReceivers.Add("ItemAdding", $Assembly , $Class)
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.