SharePoint Saturday Richmond 2014

Click image for PowerPoint

The Evolution of SharePoint Event Receivers from On-Prem to the Cloud
Session and Location: 3pm-4pm in Room 123 Lab

Here’s the code on GitHub

Event Receivers are a fundamental part of SharePoint. They have evolved from server side only to now include App events in the cloud. Knowing how to use them and what features are available for which version of SharePoint is crucial for all SharePoint developers. Drawing on my extensive experience over the past seven years, this session will give every developer a solid foundation for using Event Receivers in SharePoint (both on-prem and in the cloud) built on best practices and real world usage. This session will provide an overview of Event Receivers in SharePoint with specific focus on List Item Event Receivers. You will learn from real world examples, tips, tricks, and hear about how event receivers have been utilized at different clients. I discuss the pros and cons of using Event Receivers as well as compare them to SharePoint Workflows. I will key on the differences between the versions of SharePoint related to Event Receiver functionality and discuss new Event Receivers in SharePoint 2013, including some that work in the cloud. Finally I will show a demo of how to quickly get up and running using Visual Studio and some common use examples.

http://www.spsevents.org/city/Richmond/Richmond2014/schedule

SharePoint Saturday NYC 2014

Click image for PowerPoint.

 

The Evolution of SharePoint Event Receivers

Event Receivers are a fundamental part of SharePoint. Knowing how to use them and what features are available for which version of SharePoint is crucial for all SharePoint developers. Drawing on my extensive experience over the past six years, this session will give every developer a solid foundation for using Event Receivers in SharePoint 2007, 2010, and 2013 built on best practices and real world usage.

This session will provide an overview of Event Receivers in SharePoint with specific focus on List Item Event Receivers. You will learn from real world examples, tips, tricks, and hear about how event receivers have been utilized at different clients. I then discuss pros and cons of using Event Receivers as well as compare them to SharePoint Workflows. Secondly I will key on the differences between the versions of SharePoint related to Event Receiver functionality. Finally I will show a demo of how to quickly get up and running using Visual Studio and some common use examples.

Session and Location info here: http://lanyrd.com/2014/spsnyc/sdcbtw/

SharePoint 2013 New Event Receivers In A Nutshell

As a developer, knowing how to utilize event receivers is a must have skill in your toolbox. In SharePoint 2013 there were three major changes to Event Receivers and two minor ones. This blog post is an overview of what’s new.

The Evolution of SharePoint Event Receiver Type Enumeration

The chart below shows the progression of additions to the event receiver options in SharePoint. So far nothing has been deprecated, so each progressive release includes all the previous ones.

 

1. Remote Event Receivers
“Remote event receivers handle events that occur on an item in the app, such as a list, a list item, or a web. These events resemble those in a traditional SharePoint solution, except that they can work with the remote components of the app for SharePoint.” – http://msdn.microsoft.com/en-us/library/office/dn456315.aspx

Here are the key takeaways for remote events.

  • They can only handle a subset of events which have been traditionally available.
  • They are now available for Apps.
  • Because they call an external web service, they are only available in Auto-hosted and Provider-hosted Apps. They do not work with SharePoint-hosted Apps.

2. App Event Receiver
Now that you are familiar with Remote Events, we can now discuss App Events. These special events allow developers some control during the App lifecycle process. They are raised in the following three instances.

  1. After an App is installed.
  2. After an App is upgraded.
  3. While and App is uninstalling.

They are set in Visual Studio in the properties for the App, shown here.

Note:

 

3. Entity Instance Events
Basically this is an event receiver that gives you developer access to three events which occur when External Content Types (registered in BCS) are added, updated, or deleted. Unfortunately there is almost no information regarding this that I can find.

4. Security Event Receiver
I have briefly covered this topic before and now it is being discussed in the larger context of all the event receiver updates to SharePoint 2013. This server side only event receiver (SPSecurityEventReceiver) has received almost no fanfare since SharePoint 2013 was released. It can; however, be utilized in a variety of fashions that are extremely useful. The following are the list of events available to developers in the SPSecurityEventReceiver.

  • GroupAdded – Specifies an event that occurs after a security group is added.
  • GroupAdding – Specifies an event that occurs before a security group is added.
  • GroupDeleted – Specifies an event that occurs after a security group is deleted.
  • GroupDeleting – Specifies an event that occurs before a security group is deleted.
  • GroupUpdated – Specifies an event that occurs after a security group is updated.
  • GroupUpdating – Specifies an event that occurs before a security group is updated.
  • GroupUserAdded – Specifies an event that occurs after a user is added to a security group.
  • GroupUserAdding – Specifies an event that occurs before a user is added to a security group.
  • GroupUserDeleted – Specifies an event that occurs after a user is deleted from a security group.
  • GroupUserDeleting – Specifies an event that occurs before a user is deleted from a security group.
  • InheritanceBreaking – Specifies an event that occurs before an inheritance is broken.
  • InheritanceBroken – Specifies an event that occurs after an inheritance is broken.
  • InheritanceReset – Specifies an event that occurs after the role inheritance is restored.
  • InheritanceResetting – Specifies an event that occurs before the role inheritance is restored.
  • RoleAssignmentAdded – Specifies an event that occurs after a role assignment is added.
  • RoleAssignmentAdding – Specifies an event that occurs before a role assignment is added.
  • RoleAssignmentDeleted – Specifies an event that occurs after a role assignment is deleted.
  • RoleAssignmentDeleting – Specifies an event that occurs before a role assignment is deleted.
  • RoleDefinitionAdded – Specifies an event that occurs after a role definition is added.
  • RoleDefinitionAdding – Specifies an event that occurs before a role definition is added.
  • RoleDefinitionDeleted – Specifies an event that occurs after a role definition is deleted.
  • RoleDefinitionDeleting – Specifies an event that occurs before a role definition is deleted.
  • RoleDefinitionUpdated – Specifies an event that occurs after a role definition is updated.
  • RoleDefinitionUpdating – Specifies an event that occurs before a role definition is updated.

http://msdn.microsoft.com/en-us/library/sharepoint/microsoft.sharepoint.spsecurityeventreceiver_members.aspx

5. List Item Version Events
Lost in all this, is a small update to the SPItemEventReceiver class. There is now a way to handle events when an item or file version is deleted (ItemVersionDeleted) or is being deleted (ItemVersionDeleting). This can be helpful for records management or archival purposes.

Conclusion
The evolution of event receivers patterns the overall evolution of SharePoint itself. There are some “under the hood” (server side) enhancements but the biggest features are App related and cloud compatible. There are many positives to this evolution, my personal favorite is the emergence of the “bring your own web service” architecture. Please leave comments for discussion, any good links, or a reference for the Entity Instance events.

Tim Ferro

New SharePoint 2013 Event Receiver: SPSecurityEventReceiver

I had heard about a new server side event receiver for SharePoint 2013 about a year ago, and since I finally got around to updating my SharePoint 2010 Event Receivers talk to now include 2013 data, I began looking into all the new changes. Side note: the biggest change is actually Remote Event Receivers but that is for the App Model and not a server side change. On the server side; however, there appears to be only one: SPSecurityEventReceiver. There is not a lot of data out there currently about this but it has some great functionality. Below is an overview of the important data from the Microsoft MSDN site. Please comment if you have seen any good use examples or links to more documentation!

SPSecurityEventReceiver Class

Source: http://msdn.microsoft.com/en-us/library/sharepoint/microsoft.sharepoint.spsecurityeventreceiver.aspx

  • GroupAdded – Specifies an event that occurs after a security group is added.
  • GroupAdding – Specifies an event that occurs before a security group is added.
  • GroupDeleted – Specifies an event that occurs after a security group is deleted.
  • GroupDeleting – Specifies an event that occurs before a security group is deleted.
  • GroupUpdated – Specifies an event that occurs after a security group is updated.
  • GroupUpdating – Specifies an event that occurs before a security group is updated.
  • GroupUserAdded – Specifies an event that occurs after a user is added to a security group.
  • GroupUserAdding – Specifies an event that occurs before a user is added to a security group.
  • GroupUserDeleted – Specifies an event that occurs after a user is deleted from a security group.
  • GroupUserDeleting – Specifies an event that occurs before a user is deleted from a security group.
  • InheritanceBreaking – Specifies an event that occurs before an inheritance is broken.
  • InheritanceBroken – Specifies an event that occurs after an inheritance is broken.
  • InheritanceReset – Specifies an event that occurs after the role inheritance is restored.
  • InheritanceResetting – Specifies an event that occurs before the role inheritance is restored.
  • RoleAssignmentAdded – Specifies an event that occurs after a role assignment is added.
  • RoleAssignmentAdding – Specifies an event that occurs before a role assignment is added.
  • RoleAssignmentDeleted – Specifies an event that occurs after a role assignment is deleted.
  • RoleAssignmentDeleting – Specifies an event that occurs before a role assignment is deleted.
  • RoleDefinitionAdded – Specifies an event that occurs after a role definition is added.
  • RoleDefinitionAdding – Specifies an event that occurs before a role definition is added.
  • RoleDefinitionDeleted – Specifies an event that occurs after a role definition is deleted.
  • RoleDefinitionDeleting – Specifies an event that occurs before a role definition is deleted.
  • RoleDefinitionUpdated – Specifies an event that occurs after a role definition is updated.
  • RoleDefinitionUpdating – Specifies an event that occurs before a role definition is updated.

Source: http://msdn.microsoft.com/en-us/library/sharepoint/microsoft.sharepoint.spsecurityeventreceiver_members.aspxTim Ferro

SPSDC 2013: Slides, Code, and Screencast

SPSDC 2013 TimFerro

Click the image for the PowerPoint.

Feature1.EventReceiver.cs
EventReceiver1.cs

Here is the link to a previously recorded version of this presentation: click me.

NOVA Code Camp 2013: Slides and Code

NOVACC 2013 TimFerro
Click the image for the PowerPoint.

Feature1.EventReceiver.cs
EventReceiver1.cs

Here is the link to a previously recorded version of this presentation: click me.