Showing posts with label Create an Event Handler Feature. Show all posts
Showing posts with label Create an Event Handler Feature. Show all posts

Tuesday, November 8, 2011

Difference between SharePoint workflows and SharePoint event handlers


The main differences between SharePoint event handlers and SharePoint workflows are:
Initiation
SharePoint event handlers are automatically initiated, while SharePoint workflows can be initiated either automatically or manually.
Response
A SharePoint event handler always responds to an event that has taken or is taking place on an item, while a SharePoint workflow does not necessarily have to react to an event that is taking place. While it can react to an item being created or changed, you can also manually start a workflow after an item has been created.
User Interaction
SharePoint event handlers have no user interface, so users cannot interact with event handlers. On the other hand, you can create either ASP.NET or InfoPath forms to provide user interactivity with SharePoint workflows. And you can add even more interactivity by using SharePoint Tasks lists along with the workflow.
Duration
SharePoint event handlers run for a short period of time (generally seconds), while SharePoint workflows may run for a much longer time period (days, months, or even years).
Robustness
Since SharePoint workflows are hydrated and dehydrated, they can “survive” server reboots, while SharePoint event handlers cannot.

Tuesday, October 18, 2011

Create an Event Handler Feature

  1. Start Microsoft Visual Studio 2010.
  2. On the File menu, point to New, and then click Project.
  3. In Project Types, under Visual Basic or C#, select Event Receiver.
  4. Type DeletingEventReceiver as the project name. Click OK.
  5. In the SharePoint Customization Wizard, choose Deploy as a sandboxed solution. Click Next.
  6. In the Choose Event Receiver Settings dialog, select List Item Events in the What type of event receiver do you want? dropdown.
  7. In the What item should be the event source? dropdown, choose Tasks.
  8. Choose the An item is being deleted option in the Handle the following events list. Click Finish.
  9. In the EventReceiver1 file that is created, insert the following code in the ItemDeleting method.


properties.Status = SPEventReceiverStatus.CancelWithError;
properties.ErrorMessage = "Deleting items from " + 
properties.RelativeWebUrl + " is not supported.";

Featured Posts

Kali Linux Remote Desktop: Access GNOME from Windows Using Native RDP

  Kali Linux + GNOME 50 + GNOME Remote Desktop + Windows Remote Desktop (MSTSC) Getting a full GNOME desktop remotely on Kali Linux can be ...