Subscribe:

Labels

Monday, June 13, 2011

New Events in sharepoint 2010

New Events in sharepoint 2010:-

FeatureUpgrading
WebAdding
WebProvisioned
ListAdding
ListAdded
ListDeleting
ListDeleted
WorkflowStarting
WorkflowStarted
WorkflowPostponed
WorkflowCompleted
 
Feature Upgrading:
       This event will trigger whenever features are upgraded from one version to another.
       Add an event receiver to your feature, and uncomment the FeatureUpgrading method
       Next, go to the feature properties, and copy the values for Receiver Assembly and Receiver Class to Upgrade Actions Receiver Assembly and Upgrade Actions Receiver Class, and set an initial value for the Version property, for instance 1.0.0.0
       The CustomUpgradeAction element is the node that actually triggers the call to FeatureUpgrading.  The Name property is sent to the method as the parameter upgradeActionName, and you can use that to determine which upgrade action to perform, like this
<VersionRange BeginVersion=”1.0.0.0 EndVersion=”2.0.0.0>
    <CustomUpgradeAction Name=”UpgradeToV2/>
</VersionRange>
<VersionRange BeginVersion=”2.0.0.0 EndVersion=”3.0.0.0>
    <CustomUpgradeAction Name=”UpgradeToV3/>
</VersionRange>
public override void FeatureUpgrading
(
SPFeatureReceiverProperties properties, string upgradeActionName, System.Collections.Generic.IDictionary<string, string> parameters)
{
 switch (upgradeActionName)
 {
 case “UpgradeToV2:
 ..
 case “UpgradeToV3:
 ..
 }
Web Adding:
       Synchronous Before event that occurs before a new subsite is created, but not when the root web site of a new site collection is created.
       The WebAdding(SPWebEventProperties) event occurs on the parent Web that is creating the new subweb, since the new subweb does not yet exist. For this reason, the URL-related properties may appear to be null, when in fact these values should be the URL of the parent Web when the parent Web is the root Web
Why not In Site Collection:
       Since an event receiver has to be registered with the site collection before it's handlers can execute, the WebAdding and WebProvisioned handlers cannot run when a site collection and its root web site are created.
WebProvisioned:
       Synchronous After event that fires after a subsite is fully provisioned and the provisioning process has stopped, but does not fire when the root web site of a new site collection is created.
       This method can be configured to operate in either synchronous or asynchronous modes. To do so, set the Synchronization attribute on the SPWebEventReceiver object if you are registering by using the object model. If registering by using features, there is a Synchronization element under the Receiver tag
List Adding:
       Event that occurs before a list is created in a Web site.
public virtual void ListAdding(
                SPListEventProperties properties)
ListAdded ->Event that occurs after a list is created in a Web site.
ListDeleting -> Event that occurs before a list is deleting from a Web site.
ListDeleted -> Event that occurs after a list is deleted from a Web site.

WorkflowStarting -> Event that occurs before  workflow starts.
void WorkflowStarting(
    SPWorkflowEventProperties properties)
WorkflowStarted -> Event that occurs after workflow starts.
WorkflowPostponed -> Event that occurs after workflow Postponed.
WorkflowCompleted -> Event that occurs after workflow Completed.
 
 

No comments:

Post a Comment