question

GURUNATHANMARIAPPAN-7978 avatar image
0 Votes"
GURUNATHANMARIAPPAN-7978 asked RaytheonXie-MSFT commented

Upgrade SPItemEventReceiver Farm solution - Sharepoint 2013 to Sharepoint 2019 Modern site

Dear Experts,

We have a requirement to migrate/upgrade Event receiver (SPItemEventReceiver) developed in SharePoint 2013 to SharePoint 2019 Modern Site. We need your input on the below queries

  1. Please confirm If Event receiver (Farm solution) is supported in SharePoint 2019 Modern site. I am not referring to Remote event receiver

  2. If supported, post upgrading the code in Visual studio 2019 and deployment, Event receiver doesn't trigger while item adding and item updating events. While debugging the code , debugger doesn't reach to the break point


Thanks
Guru

office-sharepoint-server-development
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @GURUNATHANMARIAPPAN-7978 ,
I am currently doing some research on this issue, will let you know as soon as possible

0 Votes 0 ·

1 Answer

RaytheonXie-MSFT avatar image
0 Votes"
RaytheonXie-MSFT answered RaytheonXie-MSFT commented

Hi @GURUNATHANMARIAPPAN-7978 ,
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.




· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @GURUNATHANMARIAPPAN-7978 ,
Have you tried the solution I proposed?

If you have any questions or progress, you can contact me in time.

Looking forward to your reply

Have a lucky day!

Thanks,
Raytheon Xie

0 Votes 0 ·

Hi @GURUNATHANMARIAPPAN-7978 ,
Would you tell me whether your issue has been resolved or have any update?
I am looking forward to your reply.

Have a nice day!

Thanks,
Raytheon Xie

0 Votes 0 ·