Monday 25 November 2013

SharePoint Event Handlers – Asynchronous Vs Synchronous


There is a little puzzlement among Asynchronousand Synchronous events, however I believe after reading this article, there will be no place for confusion in your brain, the reason for that I go behind a childlike practice to memorize what is Asynchronous ? and what is Synchronous ?
The same babyish method, I want to share with you.
A for Applefor Asynchronous and for After events, so all Asynchronous events occur after the event, which does not stop the code to execute. All Asynchronous events end with ‘ed’ letters like SiteDeleted, FieldAdded, ItemAdded etc.
Now, let’s talk on the subject of Synchronous events, all Synchronous events  occur before the event, which stop the code to execute. All Synchronous events end with ‘ing’ letters like SiteDeleting, FieldAdding, ItemAdding etc.

SPWebEventReceiver Asynchronous Events
SiteDeletedOccurs after an existing site collection deleted.
WebDeletedOccurs after an existing web site is completely deleted.
WebMovedOccurs after an existing web site has been moved.


SPWebEventReceiver Synchronous Events
SiteDeletingOccurs before an existing site collection is being deleted.
WebDeletingOccurs before an existing web site is deleted.
WebMovingOccurs before an existing web site has been renamed or moved


SPListEventReceiver Asynchronous Methods
FieldAddedOccurs after a field link is added.
FieldDeletedOccurs after a field has been removed from the list.
FieldUpdatedOccurs after a field link has been updated


SPListEventReceiver Synchronous Methods
FieldAddingOccurs before a field link is added to a content type.
FieldDeletingOccurs before a field is removed from the list.
FieldUpdatingOccurs before a field link is updated


SPItemEventReceiver Asynchronous Methods
ItemAddedOccurs after a new item has been added
ItemAttachmentAddedOccurs after an attachment added to an item.
ItemAttachmentDeletedOccurs after an attachment removed from an item.
ItemCheckedOutOccurs after an item is checked out.
ItemDeletedOccurs after an item is completely deleted.
ItemFileMovedOccurs after a file is moved.
ItemUpdatedOccurs after an item is modified/edited.


SPListItemEventReceiver Synchronous Methods
ItemAddingOccurs before a new item is added.
ItemAttachmentAddingOccurs before an attachment is added to an item.
ItemAttachmentDeletingOccurs before an attachment when a user removed from an item.
ItemCheckingInOccurs before a file is checking-in.
ItemCheckingOutOccurs before an item is checking-out.
ItemDeletingOccurs before an item is completely deleted.
ItemFileMovingOccurs before a file is moved.
ItemUncheckedOutOccurs before an item is unchecked out.
ItemUncheckingOutBefore event that occurs when an item is being unchecked out.
ItemUpdatingOccurs before an existing item is modified/edited.


SharePoint Foundation 2010 New Events
Microsoft added several new events to SharePoint Foundation 2010 on SiteList and Item level. These fresh events are intended to meet up the requirements and for better elasticity.
SPWebEventReceiver
WebAddingOccurs before a new web site is created.
WebProvisionedOccurs after the web is provisioned.


WebAdding: event arises prior to a fresh web site is created, we can control the website to create or not to create by WebAdding event, then no SharePoint site is created and the provisioning process is not started.
WebProvisioned: event arise after the web is totally provisioned and process has stopped up. WebProvisioned can be configured to control in any synchronous or asynchronous methods.
If user wants to add few webparts to the newly provisioned web we can use this event to meet up the necessity
SPListEventReceiver
ListAddingOccurs before a list is created.
ListAddedOccurs after a list is created.
ListDeletingOccurs before a list is deleted.
ListDeletedOccurs after a list is deleted.

No comments:

Post a Comment