SharePoint 2013 Event Receiver for specific list

g h 716 Reputation points
2021-01-29T02:32:41.15+00:00

Per my understanding, Event Receiver is created for list type like libraries or Custom Lists.

However, I just want the Event Receiver for a specific list not for all Custom List Type.

Is this possible to set the condition when deployment ?

Thanks for any help.

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,577 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,566 Reputation points
    2021-01-29T07:06:59.537+00:00

    Hi @g h ,

    Yes. It's possible to attach Event Receiver to a single list, modify Elements.xml like this sepecify ListUrl instead ListTemplateId:

    <?xml version="1.0" encoding="utf-8"?>  
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">  
      <Receivers ListUrl="Lists/PublishedFeed" >  
          <Receiver>  
            <Name>NewsfeedNotificationItemAdded</Name>  
            <Type>ItemAdded</Type>  
            <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>  
            <Class>NewsfeedEventReceiver.NewsfeedNotification.NewsfeedNotification</Class>  
            <SequenceNumber>10000</SequenceNumber>  
          </Receiver>  
      </Receivers>  
    </Elements>  
    

    Reference:

    How to attach an event receiver for an specific list in SharePoint 2013

    Thanks
    Best Regards


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful