SlideShare a Scribd company logo
1 of 21
Synchronous     Asynchronous

 ItemAdding       ItemAdded

ItemUpdating     ItemUpdated

 FieldAdding     FieldUpdated

FieldDeleting    FieldDeleted

 WebAdding      WebProvisioned
public class CheckJobs : SPItemEventReceiver
{
  public override void ItemUpdating(SPItemEventProperties properties)
  {
    string oldJobTitle = properties.BeforeProperties["Title"].ToString();
    string newJobTitle = properties.AfterProperties["Title"].ToString();
    ...
    base.ItemUpdating(properties);
  }
}
public class CatchEmails : SPEmailEventReceiver
{
  public override void EmailReceived(
    SPList list,
    SPEmailMessage emailMessage,
    String receiverData)
  {
    string listTitle = list.Title;
    string sender = emailMessage.Sender;
    string body = emailMessage.PlainTextBody;
    ...
    base.EmailReceived(list, emailMessage, receiverData);
  }
}
public class MyListWorkflows : SPWorkflowEventReceiver
{
  public override void WorkflowStarted(SPWorkflowEventProperties properties)
  {
    string myInitData = properties.InitiationData;
    ...
    base.WorkflowStarted(properties);
  }
}
public class MyAuditTrail : SPListEventReceiver
{
  public override void FieldDeleting(SPListEventProperties properties)
  {
    string usrName = properties.UserLoginName;
    string listTitle = properties.ListTitle;
    ...
    base.FieldDeleting(properties);
  }
}
public class MyTopologyManager : SPWebEventReceiver
{
  public override void WebAdding(SPWebEventProperties properties)
  {
    int currentCount = properties.Web.ParentWeb.Webs.Count;
    ...
    base.WebAdding(properties);
  }
}
public class MyTopologyManager :
    SPWebEventReceiver
{
  public override void FeatureActivated
    (SPFeatureReceiverProperties properties)
  {
    setProliferationFlag(true);
  }
  public override void FeatureDeactivating
    (SPFeatureReceiverProperties properties)
  {
    setProliferationFlag(false);
  }
  void setProliferationFlag(bool status)
  {
    if (status)
    {
      ...
    }
    else
    {
      ...
    }
  }
}
public class SchemaProtector : SPListEventReceiver
{
  public override void FieldDeleting(SPListEventProperties properties)
  {
    if(properties.Field.Title == "MyRequiredDataField")
    {
      properties.ErrorMessage = "You must NOT delete this field.";
      properties.Status = SPEventReceiverStatus.CancelWithError;
      properties.Cancel = true;
      return;
    }
    base.FieldDeleting(properties);
  }
}
void setProliferationFlag()
{
  SPWebApplication webApp = SPWebApplication.Lookup(new
    Uri("http://SharePoint"));
  SPWebConfigModification mySetting = null;
  mySetting = new SPWebConfigModification();
  mySetting.Path = "configuration/appSettings";
  mySetting.Name = "add [@key='preventProliferation'] [@value='1']";
  mySetting.Sequence = 0;
  mySetting.Owner = "Lab05Owner";
  mySetting.Type =
    SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
  mySetting.Value = "<add key='preventProliferation' value='1' />";
  webApp.WebConfigModifications.Add(mySetting);
  webApp.Update();
  webApp.Farm.Services.GetValue<SPWebService>()
    .ApplyWebConfigModifications();
}
Estimated time: 45 minutes
Event recvr ss
Event recvr ss
Event recvr ss

More Related Content

What's hot

Restful services-slides
Restful services-slidesRestful services-slides
Restful services-slidesMasterCode.vn
 
Angular promises and http
Angular promises and httpAngular promises and http
Angular promises and httpAlexe Bogdan
 
Everything You (N)ever Wanted to Know about Testing View Controllers
Everything You (N)ever Wanted to Know about Testing View ControllersEverything You (N)ever Wanted to Know about Testing View Controllers
Everything You (N)ever Wanted to Know about Testing View ControllersBrian Gesiak
 
Reactive computing
Reactive computingReactive computing
Reactive computingStan Lea
 
JSON Schema: Your API's Secret Weapon
JSON Schema: Your API's Secret WeaponJSON Schema: Your API's Secret Weapon
JSON Schema: Your API's Secret WeaponPete Gamache
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Eyal Vardi
 
What's new in jQuery 1.5
What's new in jQuery 1.5What's new in jQuery 1.5
What's new in jQuery 1.5Martin Kleppe
 
Clases jasper report
Clases jasper reportClases jasper report
Clases jasper reportjbersosa
 
The Snake and the Butler
The Snake and the ButlerThe Snake and the Butler
The Snake and the ButlerBarak Korren
 
What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)Arnaud Langlade
 
Testowanie JavaScript
Testowanie JavaScriptTestowanie JavaScript
Testowanie JavaScriptTomasz Bak
 
Protocol-Oriented MVVM (extended edition)
Protocol-Oriented MVVM (extended edition)Protocol-Oriented MVVM (extended edition)
Protocol-Oriented MVVM (extended edition)Natasha Murashev
 
AngularJS Services
AngularJS ServicesAngularJS Services
AngularJS ServicesEyal Vardi
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 ArchitectureEyal Vardi
 
Practical Protocols with Associated Types
Practical Protocols with Associated TypesPractical Protocols with Associated Types
Practical Protocols with Associated TypesNatasha Murashev
 
Windows 10 - one application for all platforms. (UA Mobile 2016)
Windows 10 - one application for all platforms. (UA Mobile 2016)Windows 10 - one application for all platforms. (UA Mobile 2016)
Windows 10 - one application for all platforms. (UA Mobile 2016)Mykyta Bondarenko
 
Unidirectional Data Flow in Swift
Unidirectional Data Flow in SwiftUnidirectional Data Flow in Swift
Unidirectional Data Flow in SwiftJason Larsen
 
So cal0365productivitygroup feb2019
So cal0365productivitygroup feb2019So cal0365productivitygroup feb2019
So cal0365productivitygroup feb2019RonRohlfs1
 
Windows 10 - одно приложение для всех платформ. UA Mobile 2016.
Windows 10 - одно приложение для всех платформ. UA Mobile 2016.Windows 10 - одно приложение для всех платформ. UA Mobile 2016.
Windows 10 - одно приложение для всех платформ. UA Mobile 2016.UA Mobile
 

What's hot (20)

Restful services-slides
Restful services-slidesRestful services-slides
Restful services-slides
 
Angular promises and http
Angular promises and httpAngular promises and http
Angular promises and http
 
Everything You (N)ever Wanted to Know about Testing View Controllers
Everything You (N)ever Wanted to Know about Testing View ControllersEverything You (N)ever Wanted to Know about Testing View Controllers
Everything You (N)ever Wanted to Know about Testing View Controllers
 
Reactive computing
Reactive computingReactive computing
Reactive computing
 
JSON Schema: Your API's Secret Weapon
JSON Schema: Your API's Secret WeaponJSON Schema: Your API's Secret Weapon
JSON Schema: Your API's Secret Weapon
 
Javascript - Beyond-jQuery
Javascript - Beyond-jQueryJavascript - Beyond-jQuery
Javascript - Beyond-jQuery
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
 
What's new in jQuery 1.5
What's new in jQuery 1.5What's new in jQuery 1.5
What's new in jQuery 1.5
 
Clases jasper report
Clases jasper reportClases jasper report
Clases jasper report
 
The Snake and the Butler
The Snake and the ButlerThe Snake and the Butler
The Snake and the Butler
 
What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)
 
Testowanie JavaScript
Testowanie JavaScriptTestowanie JavaScript
Testowanie JavaScript
 
Protocol-Oriented MVVM (extended edition)
Protocol-Oriented MVVM (extended edition)Protocol-Oriented MVVM (extended edition)
Protocol-Oriented MVVM (extended edition)
 
AngularJS Services
AngularJS ServicesAngularJS Services
AngularJS Services
 
Angular 2 Architecture
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 Architecture
 
Practical Protocols with Associated Types
Practical Protocols with Associated TypesPractical Protocols with Associated Types
Practical Protocols with Associated Types
 
Windows 10 - one application for all platforms. (UA Mobile 2016)
Windows 10 - one application for all platforms. (UA Mobile 2016)Windows 10 - one application for all platforms. (UA Mobile 2016)
Windows 10 - one application for all platforms. (UA Mobile 2016)
 
Unidirectional Data Flow in Swift
Unidirectional Data Flow in SwiftUnidirectional Data Flow in Swift
Unidirectional Data Flow in Swift
 
So cal0365productivitygroup feb2019
So cal0365productivitygroup feb2019So cal0365productivitygroup feb2019
So cal0365productivitygroup feb2019
 
Windows 10 - одно приложение для всех платформ. UA Mobile 2016.
Windows 10 - одно приложение для всех платформ. UA Mobile 2016.Windows 10 - одно приложение для всех платформ. UA Mobile 2016.
Windows 10 - одно приложение для всех платформ. UA Mobile 2016.
 

Viewers also liked

Case : Customer Relationship Management Heads to the Cloud
Case : Customer Relationship Management Heads to the CloudCase : Customer Relationship Management Heads to the Cloud
Case : Customer Relationship Management Heads to the CloudAya Wan Idris
 
Tayammum
TayammumTayammum
TayammumJahneta
 
Case 5.1 - DESIGNING DRUGS VIRTUALLY
Case 5.1 - DESIGNING DRUGS VIRTUALLYCase 5.1 - DESIGNING DRUGS VIRTUALLY
Case 5.1 - DESIGNING DRUGS VIRTUALLYAya Wan Idris
 
CASE 1 : Big Data Big Reward
CASE 1 : Big Data Big RewardCASE 1 : Big Data Big Reward
CASE 1 : Big Data Big RewardAya Wan Idris
 
Case 5.3 - Knowledge Management and Collaboration at Tata Consulting Services
Case 5.3 - Knowledge Management and Collaboration at Tata Consulting ServicesCase 5.3 - Knowledge Management and Collaboration at Tata Consulting Services
Case 5.3 - Knowledge Management and Collaboration at Tata Consulting ServicesAya Wan Idris
 
Nasi ayam
Nasi ayamNasi ayam
Nasi ayam800604
 
Case : Groupon's Business Model - Social and Local
Case : Groupon's Business Model - Social and LocalCase : Groupon's Business Model - Social and Local
Case : Groupon's Business Model - Social and LocalAya Wan Idris
 
Submit Electric Light Up with a New ERP system
Submit Electric Light Up with a New ERP systemSubmit Electric Light Up with a New ERP system
Submit Electric Light Up with a New ERP systemAya Wan Idris
 
Submit Electric Light Up with a New ERP system
Submit Electric Light Up with a New ERP systemSubmit Electric Light Up with a New ERP system
Submit Electric Light Up with a New ERP systemAya Wan Idris
 
ALBASSAMI ‘S JOB IS NOT FEASIBLE WITHOUT IT
ALBASSAMI ‘S JOB IS NOT FEASIBLE WITHOUT  ITALBASSAMI ‘S JOB IS NOT FEASIBLE WITHOUT  IT
ALBASSAMI ‘S JOB IS NOT FEASIBLE WITHOUT ITAya Wan Idris
 
Case 2.1 : Modernization of NTUC Income
Case 2.1 : Modernization of NTUC IncomeCase 2.1 : Modernization of NTUC Income
Case 2.1 : Modernization of NTUC IncomeAya Wan Idris
 
The Battle Over Net Neutrality
The Battle Over Net NeutralityThe Battle Over Net Neutrality
The Battle Over Net NeutralityAya Wan Idris
 
Case 2.2 : Facebook It's About the Money
Case 2.2 : Facebook It's About the MoneyCase 2.2 : Facebook It's About the Money
Case 2.2 : Facebook It's About the MoneyAya Wan Idris
 

Viewers also liked (18)

Case : Customer Relationship Management Heads to the Cloud
Case : Customer Relationship Management Heads to the CloudCase : Customer Relationship Management Heads to the Cloud
Case : Customer Relationship Management Heads to the Cloud
 
Tayammum
TayammumTayammum
Tayammum
 
Case 5.1 - DESIGNING DRUGS VIRTUALLY
Case 5.1 - DESIGNING DRUGS VIRTUALLYCase 5.1 - DESIGNING DRUGS VIRTUALLY
Case 5.1 - DESIGNING DRUGS VIRTUALLY
 
CASE 1 : Big Data Big Reward
CASE 1 : Big Data Big RewardCASE 1 : Big Data Big Reward
CASE 1 : Big Data Big Reward
 
Social features sp2013
Social features sp2013Social features sp2013
Social features sp2013
 
Case 5.3 - Knowledge Management and Collaboration at Tata Consulting Services
Case 5.3 - Knowledge Management and Collaboration at Tata Consulting ServicesCase 5.3 - Knowledge Management and Collaboration at Tata Consulting Services
Case 5.3 - Knowledge Management and Collaboration at Tata Consulting Services
 
PowerShell Conference Asia
PowerShell Conference AsiaPowerShell Conference Asia
PowerShell Conference Asia
 
Nasi ayam
Nasi ayamNasi ayam
Nasi ayam
 
Workflows ss
Workflows ssWorkflows ss
Workflows ss
 
Search
SearchSearch
Search
 
Ski Cuba
Ski CubaSki Cuba
Ski Cuba
 
Case : Groupon's Business Model - Social and Local
Case : Groupon's Business Model - Social and LocalCase : Groupon's Business Model - Social and Local
Case : Groupon's Business Model - Social and Local
 
Submit Electric Light Up with a New ERP system
Submit Electric Light Up with a New ERP systemSubmit Electric Light Up with a New ERP system
Submit Electric Light Up with a New ERP system
 
Submit Electric Light Up with a New ERP system
Submit Electric Light Up with a New ERP systemSubmit Electric Light Up with a New ERP system
Submit Electric Light Up with a New ERP system
 
ALBASSAMI ‘S JOB IS NOT FEASIBLE WITHOUT IT
ALBASSAMI ‘S JOB IS NOT FEASIBLE WITHOUT  ITALBASSAMI ‘S JOB IS NOT FEASIBLE WITHOUT  IT
ALBASSAMI ‘S JOB IS NOT FEASIBLE WITHOUT IT
 
Case 2.1 : Modernization of NTUC Income
Case 2.1 : Modernization of NTUC IncomeCase 2.1 : Modernization of NTUC Income
Case 2.1 : Modernization of NTUC Income
 
The Battle Over Net Neutrality
The Battle Over Net NeutralityThe Battle Over Net Neutrality
The Battle Over Net Neutrality
 
Case 2.2 : Facebook It's About the Money
Case 2.2 : Facebook It's About the MoneyCase 2.2 : Facebook It's About the Money
Case 2.2 : Facebook It's About the Money
 

Similar to Event recvr ss

srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxsrcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxwhitneyleman54422
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeletonIram Ramrajkar
 
Using Reflections and Automatic Code Generation
Using Reflections and Automatic Code GenerationUsing Reflections and Automatic Code Generation
Using Reflections and Automatic Code GenerationIvan Dolgushin
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
Testdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinnerTestdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinnerTruls Jørgensen
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbroncymbron
 
Scala in practice
Scala in practiceScala in practice
Scala in practicepatforna
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stackTomáš Kypta
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScriptkvangork
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascriptkvangork
 
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfpackage net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfsudhirchourasia86
 
Soundreader.classpathSoundreader.project Soundre.docx
Soundreader.classpathSoundreader.project  Soundre.docxSoundreader.classpathSoundreader.project  Soundre.docx
Soundreader.classpathSoundreader.project Soundre.docxwhitneyleman54422
 
Painless Persistence with Realm
Painless Persistence with RealmPainless Persistence with Realm
Painless Persistence with RealmChristian Melchior
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍louieuser
 
Get started with YUI
Get started with YUIGet started with YUI
Get started with YUIAdam Lu
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsJarod Ferguson
 

Similar to Event recvr ss (20)

srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxsrcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
Using Reflections and Automatic Code Generation
Using Reflections and Automatic Code GenerationUsing Reflections and Automatic Code Generation
Using Reflections and Automatic Code Generation
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Testdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinnerTestdrevet javautvikling på objektorienterte skinner
Testdrevet javautvikling på objektorienterte skinner
 
Jason parsing
Jason parsingJason parsing
Jason parsing
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbron
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stack
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScript
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascript
 
Ad java prac sol set
Ad java prac sol setAd java prac sol set
Ad java prac sol set
 
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdfpackage net.codejava.swing.mail;import java.awt.Font;import java.pdf
package net.codejava.swing.mail;import java.awt.Font;import java.pdf
 
Soundreader.classpathSoundreader.project Soundre.docx
Soundreader.classpathSoundreader.project  Soundre.docxSoundreader.classpathSoundreader.project  Soundre.docx
Soundreader.classpathSoundreader.project Soundre.docx
 
Painless Persistence with Realm
Painless Persistence with RealmPainless Persistence with Realm
Painless Persistence with Realm
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
 
Get started with YUI
Get started with YUIGet started with YUI
Get started with YUI
 
Taming that client side mess with Backbone.js
Taming that client side mess with Backbone.jsTaming that client side mess with Backbone.js
Taming that client side mess with Backbone.js
 
Clean coding-practices
Clean coding-practicesClean coding-practices
Clean coding-practices
 

Event recvr ss

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. Synchronous Asynchronous ItemAdding ItemAdded ItemUpdating ItemUpdated FieldAdding FieldUpdated FieldDeleting FieldDeleted WebAdding WebProvisioned
  • 7.
  • 8. public class CheckJobs : SPItemEventReceiver { public override void ItemUpdating(SPItemEventProperties properties) { string oldJobTitle = properties.BeforeProperties["Title"].ToString(); string newJobTitle = properties.AfterProperties["Title"].ToString(); ... base.ItemUpdating(properties); } }
  • 9. public class CatchEmails : SPEmailEventReceiver { public override void EmailReceived( SPList list, SPEmailMessage emailMessage, String receiverData) { string listTitle = list.Title; string sender = emailMessage.Sender; string body = emailMessage.PlainTextBody; ... base.EmailReceived(list, emailMessage, receiverData); } }
  • 10. public class MyListWorkflows : SPWorkflowEventReceiver { public override void WorkflowStarted(SPWorkflowEventProperties properties) { string myInitData = properties.InitiationData; ... base.WorkflowStarted(properties); } }
  • 11. public class MyAuditTrail : SPListEventReceiver { public override void FieldDeleting(SPListEventProperties properties) { string usrName = properties.UserLoginName; string listTitle = properties.ListTitle; ... base.FieldDeleting(properties); } }
  • 12. public class MyTopologyManager : SPWebEventReceiver { public override void WebAdding(SPWebEventProperties properties) { int currentCount = properties.Web.ParentWeb.Webs.Count; ... base.WebAdding(properties); } }
  • 13. public class MyTopologyManager : SPWebEventReceiver { public override void FeatureActivated (SPFeatureReceiverProperties properties) { setProliferationFlag(true); } public override void FeatureDeactivating (SPFeatureReceiverProperties properties) { setProliferationFlag(false); } void setProliferationFlag(bool status) { if (status) { ... } else { ... } } }
  • 14. public class SchemaProtector : SPListEventReceiver { public override void FieldDeleting(SPListEventProperties properties) { if(properties.Field.Title == "MyRequiredDataField") { properties.ErrorMessage = "You must NOT delete this field."; properties.Status = SPEventReceiverStatus.CancelWithError; properties.Cancel = true; return; } base.FieldDeleting(properties); } }
  • 15.
  • 16.
  • 17. void setProliferationFlag() { SPWebApplication webApp = SPWebApplication.Lookup(new Uri("http://SharePoint")); SPWebConfigModification mySetting = null; mySetting = new SPWebConfigModification(); mySetting.Path = "configuration/appSettings"; mySetting.Name = "add [@key='preventProliferation'] [@value='1']"; mySetting.Sequence = 0; mySetting.Owner = "Lab05Owner"; mySetting.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode; mySetting.Value = "<add key='preventProliferation' value='1' />"; webApp.WebConfigModifications.Add(mySetting); webApp.Update(); webApp.Farm.Services.GetValue<SPWebService>() .ApplyWebConfigModifications(); }