<br />
<b>Deprecated</b>:  YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container::__construct(): Implicitly marking parameter $parameterBag as nullable is deprecated, the explicit nullable type must be used instead in <b>/home/nubelus/sharedove/adisjugo/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php</b> on line <b>60</b><br />
<br />
<b>Deprecated</b>:  YoastSEO_Vendor\League\OAuth2\Client\Provider\AbstractProvider::authorize(): Implicitly marking parameter $redirectHandler as nullable is deprecated, the explicit nullable type must be used instead in <b>/home/nubelus/sharedove/adisjugo/wp-content/plugins/wordpress-seo/vendor_prefixed/league/oauth2-client/src/Provider/AbstractProvider.php</b> on line <b>416</b><br />
<br />
<b>Deprecated</b>:  YoastSEO_Vendor\GuzzleHttp\Client::getConfig(): Implicitly marking parameter $option as nullable is deprecated, the explicit nullable type must be used instead in <b>/home/nubelus/sharedove/adisjugo/wp-content/plugins/wordpress-seo/vendor_prefixed/guzzlehttp/guzzle/src/Client.php</b> on line <b>181</b><br />
<br />
<b>Deprecated</b>:  YoastSEO_Vendor\GuzzleHttp\ClientInterface::getConfig(): Implicitly marking parameter $option as nullable is deprecated, the explicit nullable type must be used instead in <b>/home/nubelus/sharedove/adisjugo/wp-content/plugins/wordpress-seo/vendor_prefixed/guzzlehttp/guzzle/src/ClientInterface.php</b> on line <b>77</b><br />
{"id":522,"date":"2011-04-26T11:18:12","date_gmt":"2011-04-26T09:18:12","guid":{"rendered":"https:\/\/blog.sharedove.com\/adisjugo\/?p=522"},"modified":"2011-04-26T11:18:12","modified_gmt":"2011-04-26T09:18:12","slug":"sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch","status":"publish","type":"post","link":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/","title":{"rendered":"SharePoint 2010 &#8211; Develop and deploy a SharePoint Event Receiver from the scratch"},"content":{"rendered":"<p>Develop and deploy a SharePoint Event Receiver from the scratch<\/p>\n<p>There are many information peaces on the internet how to build a decent working event receiver in SharePoint \u2013 mainly good, but still, only peaces. I\u2019ll try to present here a complete and quick \u201chow to\u201d guide  &#8211; from making decision which event we want to catch until the event deployment.<\/p>\n<p><!--more--><\/p>\n<p>What you will not find here is a description of developing event handlers using <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?familyid=7BF65B28-06E2-4E87-9BAD-086E32185E68&amp;displaylang=en\" target=\"_blank\">Windows SharePoint Services 3.0 Tools: Visual Studio 2008 Extensions<\/a> \u2013 you cannot use them in x64 environments, and \u201cNull reference exception\u201d by deployment pops up much too often for my taste. Well, we are all waiting for 1.3 version, but until then\u2026<\/p>\n<h4>Events<\/h4>\n<p>SharePoint is quite rich with the events it exposes. We can categorize SharePoint events in two different categories: by the \u201clevel\u201d which fires the event (site, list, item), and by the type of the event (synchronous and asynchronous).<\/p>\n<p>What means synchronous  \/ asynchronous?<\/p>\n<ul>\n<li><strong>Synchronous<\/strong>: happens &#8216;before&#8217; the actual event, you have the HttpContext and you can show an error message in the browser and cancel the event.<\/li>\n<li><strong>Asynchronous<\/strong>: happens &#8216;after&#8217; the actual event, there&#8217;s no HttpContext  and you cannot directly show an error message or cancel the event \u2013 you can handle what happens after the event is fired.<\/li>\n<\/ul>\n<p>As an example of synchronous and asynchronous events we can take item-level events \u201c<em>ItemAdding<\/em>\u201d and \u201c<em>ItemAdded<\/em>\u201d \u2013 by handling of \u201c<em>ItemAdding<\/em>\u201d we can take a look what that item is, and, if necessary, cancel the adding and display the error message in the SharePoint page to the user. When handling \u201c<em>ItemAdded<\/em>\u201d, we know that the item is already in the SharePoint list, but we can start some post-add actions with that item.<\/p>\n<p>Complete table of SharePoint events you can find <a href=\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2009\/03\/11\/list-of-sharepoint-events\/\" target=\"_blank\">in my previous post<\/a>.<\/p>\n<p>In this example, we are going to create a simple receiver, which will handle two Asynchronous events (<em>ItemAdded<\/em> and <em>ItemUpdated<\/em>) in all Document and Picture libraries at one SharePoint web site, and deploy it as a web site &#8211; level feature.<\/p>\n<p>In the code which handles these two events, we are then going to break permissions inheritance for given item and to set the custom item-level based permissions.<\/p>\n<h4>Defining a feature for our event receiver<\/h4>\n<p>We want to deploy our event receiver as a feature, so, first of all, we have to create a Feature Folder in the Features setup directory  (<span style=\"font-family: Courier New; font-size: x-small;\">Local_Drive:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURES<\/span>). Let\u2019s say, our feature will be named \u201c<em>Set Items Permissions Event Handler<\/em>\u201d, so we name our Feature Folder as \u201c<em>PermissionsEventHandler<\/em>\u201d.<\/p>\n<p>A Feature folder (<em>PermissionsEventHandler<\/em>) may contain only a Feature.xml file (which describes our feature), or it may contain a Feature.xml file and any number of supporting element files. In our case, Feature folder will, beside the Feature.xml, contain only Elements.xml file, which will describe which events we want to receive and handle.<\/p>\n<ul>\n<li>Feature.xml &#8211; .xml file that defines the base properties of the Feature and lists elements bound to it, such as XML files containing element manifests and any other supporting files<\/li>\n<li>Elements.xml \u2013 a \u201cmanifest file\u201d &#8211;  .xml file that contains definitions to the feature&#8217;s elements. This manifest file is referenced from Feature.xml. In our case, it will contain events we want to receive and handle<\/li>\n<\/ul>\n<p>So, we have made the \u201cPermissionsEventHandler\u201d  folder, and our Feature.xml and Elements.xml files in it. Let\u2019s look at the structure of the both XML files:<\/p>\n<h5>Feature.xml<\/h5>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 359px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum1\" style=\"color: #606060;\"> 1:<\/span> <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Feature<\/span> <span style=\"color: #ff0000;\">Scope<\/span><span style=\"color: #0000ff;\">=\"Web\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum2\" style=\"color: #606060;\"> 2:<\/span>     <span style=\"color: #ff0000;\">Title<\/span><span style=\"color: #0000ff;\">=\"Set Items Permissions Event Handler\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum3\" style=\"color: #606060;\"> 3:<\/span>     <span style=\"color: #ff0000;\">Description<\/span> = <span style=\"color: #0000ff;\">\"Sets the item permissions immediately upon item is added or edited\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum4\" style=\"color: #606060;\"> 4:<\/span>     <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #0000ff;\">=\"98D6B8CB-1C6A-469c-9119-717AEBE68515\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum5\" style=\"color: #606060;\"> 5:<\/span>     <span style=\"color: #ff0000;\">xmlns<\/span><span style=\"color: #0000ff;\">=\"http:\/\/schemas.microsoft.com\/sharepoint\/\"<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum6\" style=\"color: #606060;\"> 6:<\/span>         <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">ElementManifests<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum7\" style=\"color: #606060;\"> 7:<\/span>             <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">ElementManifest<\/span> <span style=\"color: #ff0000;\">Location<\/span><span style=\"color: #0000ff;\">=\"Elements.xml\"<\/span><span style=\"color: #0000ff;\">\/&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum8\" style=\"color: #606060;\"> 8:<\/span>         <span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">ElementManifests<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum9\" style=\"color: #606060;\"> 9:<\/span>         <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Properties<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum10\" style=\"color: #606060;\"> 10:<\/span>             <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Property<\/span> <span style=\"color: #ff0000;\">Key<\/span><span style=\"color: #0000ff;\">=\"OwnersGroupName\"<\/span> <span style=\"color: #ff0000;\">Value<\/span><span style=\"color: #0000ff;\">=\"MySiteOwners\"<\/span><span style=\"color: #0000ff;\">\/&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum11\" style=\"color: #606060;\"> 11:<\/span>             <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Property<\/span> <span style=\"color: #ff0000;\">Key<\/span><span style=\"color: #0000ff;\">=\"VisitorsGroupName\"<\/span> <span style=\"color: #ff0000;\">Value<\/span><span style=\"color: #0000ff;\">=\"MySiteVisitors\"<\/span><span style=\"color: #0000ff;\">\/&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum12\" style=\"color: #606060;\"> 12:<\/span>             <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Property<\/span> <span style=\"color: #ff0000;\">Key<\/span><span style=\"color: #0000ff;\">=\"ContributorsGroupName\"<\/span> <span style=\"color: #ff0000;\">Value<\/span><span style=\"color: #0000ff;\">=\"MySiteContributors\"<\/span><span style=\"color: #0000ff;\">\/&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum13\" style=\"color: #606060;\"> 13:<\/span>         <span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Properties<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum14\" style=\"color: #606060;\"> 14:<\/span> <span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Feature<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p>In the first line, we define the feature scope, it\u2019s a kind of the feature visibility: from which hierarchy level will our feature be accessible. We want to have this feature only at one SharePoint Web site, so our scope is going to be Web, but it can vary between <em>Farm<\/em> (SharePoint Farm), <em>WebApplication <\/em>(SharePoint application), <em>Site<\/em> (site collection), and Web (SharePoint web site). <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms476615.aspx\" target=\"_blank\">Here you can find out more about scopes<\/a>.<\/p>\n<p>In the lines 2-5, we see the feature name, description and Guid. We create the feature guid ourselves, and it will serve as the unique identifier for this feature which we will use later.<\/p>\n<p>In the lines 6-8 we create a reference to the Elements.xml manifest file, which will define events we want to handle.<\/p>\n<p>In the lines 9-13 we can define <em>Feature Properties<\/em>, you can consider it as kind of the string resources for our feature \u2013 they are actually key\/value pairs. In this case we have stored the names of the SharePoint groups to which we are going to give permissions to this item after we break inheritance, so that we don\u2019t have to hard code these names in our source code.<\/p>\n<h5>Elements.xml<\/h5>\n<p>Our event receiver has to catch the following events: ItemAdded and ItemUpdated at all the Document Libraries and Picture libraries on the SharePoint site on which the feature has been activated.<\/p>\n<p>This is exactly what we have to describe in the Elements.xml file of our feature: which events we hook onto, and which types of the lists\/libraries we want to observe.<\/p>\n<p>We know the events (ItemAdded, ItemUpdated), we still need to know the codes for the lists and libraries we want to \u201cobserve\u201d. In our case <strong>101<\/strong> is a standard document library, and <strong>109<\/strong> is a standard picture library. Full list of the list and library types <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.splisttemplatetype.aspx\" target=\"_blank\">you can find here<\/a>.<\/p>\n<p>So, let\u2019s look at the Elements.xml with necessary definitions:<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum1\" style=\"color: #606060;\"> 1:<\/span> <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Elements<\/span> <span style=\"color: #ff0000;\">xmlns<\/span><span style=\"color: #0000ff;\">=\"http:\/\/schemas.microsoft.com\/sharepoint\/\"<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum2\" style=\"color: #606060;\"> 2:<\/span>   <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Receivers<\/span> <span style=\"color: #ff0000;\">ListTemplateId<\/span><span style=\"color: #0000ff;\">=\"101\"<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum3\" style=\"color: #606060;\"> 3:<\/span>     <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Receiver<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum4\" style=\"color: #606060;\"> 4:<\/span>       <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Name<\/span><span style=\"color: #0000ff;\">&gt;<\/span>DocLibraryPermissionsEventHandlerOnAdded<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Name<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum5\" style=\"color: #606060;\"> 5:<\/span>       <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Type<\/span><span style=\"color: #0000ff;\">&gt;<\/span>ItemAdded<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Type<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum6\" style=\"color: #606060;\"> 6:<\/span>       <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">SequenceNumber<\/span><span style=\"color: #0000ff;\">&gt;<\/span>10000<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">SequenceNumber<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum7\" style=\"color: #606060;\"> 7:<\/span>       <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PermissionsEventHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=67d615643aea660a<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum8\" style=\"color: #606060;\"> 8:<\/span>       <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PermissionsEventHandler.PermissionsHandler<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum9\" style=\"color: #606060;\"> 9:<\/span>       <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Data<\/span><span style=\"color: #0000ff;\">&gt;&lt;\/<\/span><span style=\"color: #800000;\">Data<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum10\" style=\"color: #606060;\"> 10:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Filter<\/span><span style=\"color: #0000ff;\">&gt;&lt;\/<\/span><span style=\"color: #800000;\">Filter<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum11\" style=\"color: #606060;\"> 11:<\/span>      <span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Receiver<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum12\" style=\"color: #606060;\"> 12:<\/span>      <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Receiver<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum13\" style=\"color: #606060;\"> 13:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Name<\/span><span style=\"color: #0000ff;\">&gt;<\/span>DocLibraryPermissionsEventHandlerOnUpdated<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Name<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum14\" style=\"color: #606060;\"> 14:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Type<\/span><span style=\"color: #0000ff;\">&gt;<\/span>ItemUpdated<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Type<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum15\" style=\"color: #606060;\"> 15:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">SequenceNumber<\/span><span style=\"color: #0000ff;\">&gt;<\/span>10001<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">SequenceNumber<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum16\" style=\"color: #606060;\"> 16:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PermissionsEventHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=67d615643aea660a<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum17\" style=\"color: #606060;\"> 17:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PermissionsEventHandler.PermissionsHandler<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum18\" style=\"color: #606060;\"> 18:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Data<\/span><span style=\"color: #0000ff;\">&gt;&lt;\/<\/span><span style=\"color: #800000;\">Data<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum19\" style=\"color: #606060;\"> 19:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Filter<\/span><span style=\"color: #0000ff;\">&gt;&lt;\/<\/span><span style=\"color: #800000;\">Filter<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum20\" style=\"color: #606060;\"> 20:<\/span>      <span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Receiver<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum21\" style=\"color: #606060;\"> 21:<\/span>    <span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Receivers<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum22\" style=\"color: #606060;\"> 22:<\/span>    <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Receivers<\/span> <span style=\"color: #ff0000;\">ListTemplateId<\/span><span style=\"color: #0000ff;\">=\"109\"<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum23\" style=\"color: #606060;\"> 23:<\/span>      <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Receiver<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum24\" style=\"color: #606060;\"> 24:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Name<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PictureLibraryPermissionsEventHandlerOnAdded<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Name<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum25\" style=\"color: #606060;\"> 25:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Type<\/span><span style=\"color: #0000ff;\">&gt;<\/span>ItemAdded<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Type<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum26\" style=\"color: #606060;\"> 26:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">SequenceNumber<\/span><span style=\"color: #0000ff;\">&gt;<\/span>10000<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">SequenceNumber<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum27\" style=\"color: #606060;\"> 27:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PermissionsEventHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=67d615643aea660a<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum28\" style=\"color: #606060;\"> 28:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PermissionsEventHandler.PermissionsHandler<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum29\" style=\"color: #606060;\"> 29:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Data<\/span><span style=\"color: #0000ff;\">&gt;&lt;\/<\/span><span style=\"color: #800000;\">Data<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum30\" style=\"color: #606060;\"> 30:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Filter<\/span><span style=\"color: #0000ff;\">&gt;&lt;\/<\/span><span style=\"color: #800000;\">Filter<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum31\" style=\"color: #606060;\"> 31:<\/span>      <span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Receiver<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum32\" style=\"color: #606060;\"> 32:<\/span>      <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Receiver<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum33\" style=\"color: #606060;\"> 33:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Name<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PictureLibraryPermissionsEventHandlerOnUpdated<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Name<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum34\" style=\"color: #606060;\"> 34:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Type<\/span><span style=\"color: #0000ff;\">&gt;<\/span>ItemUpdated<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Type<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum35\" style=\"color: #606060;\"> 35:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">SequenceNumber<\/span><span style=\"color: #0000ff;\">&gt;<\/span>10001<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">SequenceNumber<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum36\" style=\"color: #606060;\"> 36:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PermissionsEventHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=67d615643aea660a<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum37\" style=\"color: #606060;\"> 37:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PermissionsEventHandler.PermissionsHandler<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum38\" style=\"color: #606060;\"> 38:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Data<\/span><span style=\"color: #0000ff;\">&gt;&lt;\/<\/span><span style=\"color: #800000;\">Data<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum39\" style=\"color: #606060;\"> 39:<\/span>        <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Filter<\/span><span style=\"color: #0000ff;\">&gt;&lt;\/<\/span><span style=\"color: #800000;\">Filter<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum40\" style=\"color: #606060;\"> 40:<\/span>      <span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Receiver<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum41\" style=\"color: #606060;\"> 41:<\/span>    <span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Receivers<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum42\" style=\"color: #606060;\"> 42:<\/span> <span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Elements<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p>So, what do we have here?<\/p>\n<p>The first-level node is \u201c<em>Receivers<\/em>\u201d, where we define the list types we want to hook on \u2013 we have only two Receivers nodes, with the attributes ListTemplateId with values 101 (Document Library) and 109 (Picture library).<\/p>\n<p>Now, inside each \u201cReceivers\u201d node, we define \u201cReceiver\u201d nodes with the events we want to hook onto: in our both \u201cReceivers\u201d, we have two \u201cReceiver\u201d nodes \u2013 with types \u201cItemAdded\u201d and \u201cItemUpdated\u201d.<\/p>\n<p>Each Receivers node has following child nodes:<\/p>\n<ul>\n<li><strong>Name<\/strong> \u2013 unique name for the receiver \u2013 you can set it upon your wish<\/li>\n<li><strong>Type<\/strong> \u2013 is actually the event name from the events table<\/li>\n<li><strong>SequenceNumber<\/strong> \u2013 integer which determines in which order the event receivers will be fired<\/li>\n<li><strong>Assembly<\/strong> \u2013 our assembly (DLL) which actually contains event landler. Assembly will be deployed in GAC.<\/li>\n<li><strong>Class<\/strong> \u2013 class in our assembly which contains item receivers<\/li>\n<\/ul>\n<p>The tricky part here are <em>Assembly<\/em> and <em>Class<\/em> tags \u2013 we do not have them yet, so we\u2019ll return later to fill it in.<\/p>\n<p>OK, the feature for our event receiver is (almost) ready, let\u2019s finally start writing some code!<\/p>\n<h4>Developing an Event Receiver<\/h4>\n<p>Let\u2019s look now on the event receiver code itself.<\/p>\n<p>Since we are going to user Microsoft.SharePoint namespace \u2013 we have to develop directly on the MOSS server, there is (unfortunately) no way around.<\/p>\n<p>We have to create a \u201cClass Library\u201d project, in our case with the \u201cPermissionsEventHandler\u201d name, and to set that the namespace for the project is as well \u201cPermissionsEventHandler\u201d.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Please, sign the project immediately<\/span><\/strong>, since SharePoint will reject to execute the feature if it does not have a strong name,<\/p>\n<p>Add a new reference in our project to the Microsoft.SharePoint.dll \u2013 you will have to browse for the file, it is placed in the 12 Hives ISAPI folder:<\/p>\n<p><span style=\"font-family: Courier New;\">LocalDrive:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12ISAPIMicrosoft.SharePoint.dll<\/span><\/p>\n<p>Now, create a Class in the project, with the name \u201cPermissionsHandler\u201d, which inherits \u201cSPItemEventReceiver\u201d class, because both of the events we want to handle are methods of the SPItemEventReciever class.<\/p>\n<p>Let\u2019s look at a full class code:<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 98.97%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 600px; max-height: 600px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum1\" style=\"color: #606060;\"> 1:<\/span> <span style=\"color: #0000ff;\">using<\/span> System;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum2\" style=\"color: #606060;\"> 2:<\/span> <span style=\"color: #0000ff;\">using<\/span> System.Collections.Generic;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum3\" style=\"color: #606060;\"> 3:<\/span> <span style=\"color: #0000ff;\">using<\/span> System.Linq;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum4\" style=\"color: #606060;\"> 4:<\/span> <span style=\"color: #0000ff;\">using<\/span> System.Text;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum5\" style=\"color: #606060;\"> 5:<\/span> <span style=\"color: #0000ff;\">using<\/span> Microsoft.SharePoint;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum6\" style=\"color: #606060;\"> 6:<\/span> <span style=\"color: #0000ff;\">using<\/span> System.Diagnostics;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum7\" style=\"color: #606060;\"> 7:<\/span> <span style=\"color: #0000ff;\">using<\/span> System.Configuration;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum8\" style=\"color: #606060;\"> 8:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum9\" style=\"color: #606060;\"> 9:<\/span> <span style=\"color: #0000ff;\">namespace<\/span> PermissionsEventHandler<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum10\" style=\"color: #606060;\"> 10:<\/span> {<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum11\" style=\"color: #606060;\"> 11:<\/span>     <span style=\"color: #0000ff;\">public<\/span> <span style=\"color: #0000ff;\">class<\/span> PermissionsHandler : SPItemEventReceiver<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum12\" style=\"color: #606060;\"> 12:<\/span>     {<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum13\" style=\"color: #606060;\"> 13:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum14\" style=\"color: #606060;\"> 14:<\/span>         <span style=\"color: #008000;\">\/\/\/ &lt;summary&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum15\" style=\"color: #606060;\"> 15:<\/span>         <span style=\"color: #008000;\">\/\/\/ Update item permissions when item has been added<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum16\" style=\"color: #606060;\"> 16:<\/span>         <span style=\"color: #008000;\">\/\/\/ &lt;\/summary&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum17\" style=\"color: #606060;\"> 17:<\/span>         <span style=\"color: #008000;\">\/\/\/ &lt;param name=\"properties\"&gt;Item event properties&lt;\/param&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum18\" style=\"color: #606060;\"> 18:<\/span>         <span style=\"color: #0000ff;\">public<\/span> <span style=\"color: #0000ff;\">override<\/span> <span style=\"color: #0000ff;\">void<\/span> ItemAdded(SPItemEventProperties properties)<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum19\" style=\"color: #606060;\"> 19:<\/span>         {<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum20\" style=\"color: #606060;\"> 20:<\/span>             updateItemPermissions(properties);<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum21\" style=\"color: #606060;\"> 21:<\/span>         }<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum22\" style=\"color: #606060;\"> 22:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum23\" style=\"color: #606060;\"> 23:<\/span>         <span style=\"color: #008000;\">\/\/\/ &lt;summary&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum24\" style=\"color: #606060;\"> 24:<\/span>         <span style=\"color: #008000;\">\/\/\/ Update item permissions when item has been updated<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum25\" style=\"color: #606060;\"> 25:<\/span>         <span style=\"color: #008000;\">\/\/\/ &lt;\/summary&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum26\" style=\"color: #606060;\"> 26:<\/span>         <span style=\"color: #008000;\">\/\/\/ &lt;param name=\"properties\"&gt;Item event properties&lt;\/param&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum27\" style=\"color: #606060;\"> 27:<\/span>         <span style=\"color: #0000ff;\">public<\/span> <span style=\"color: #0000ff;\">override<\/span> <span style=\"color: #0000ff;\">void<\/span> ItemUpdated(SPItemEventProperties properties)<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum28\" style=\"color: #606060;\"> 28:<\/span>         {<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum29\" style=\"color: #606060;\"> 29:<\/span>             updateItemPermissions(properties);<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum30\" style=\"color: #606060;\"> 30:<\/span>         }<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum31\" style=\"color: #606060;\"> 31:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum32\" style=\"color: #606060;\"> 32:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum33\" style=\"color: #606060;\"> 33:<\/span>         <span style=\"color: #008000;\">\/\/\/ &lt;summary&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum34\" style=\"color: #606060;\"> 34:<\/span>         <span style=\"color: #008000;\">\/\/\/ Updates permissions on the library items<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum35\" style=\"color: #606060;\"> 35:<\/span>         <span style=\"color: #008000;\">\/\/\/ &lt;\/summary&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum36\" style=\"color: #606060;\"> 36:<\/span>         <span style=\"color: #008000;\">\/\/\/ &lt;param name=\"properties\"&gt;event properties&lt;\/param&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum37\" style=\"color: #606060;\"> 37:<\/span>         <span style=\"color: #0000ff;\">private<\/span> <span style=\"color: #0000ff;\">void<\/span> updateItemPermissions(SPItemEventProperties properties)<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum38\" style=\"color: #606060;\"> 38:<\/span>         {<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum39\" style=\"color: #606060;\"> 39:<\/span>             <span style=\"color: #0000ff;\">try<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum40\" style=\"color: #606060;\"> 40:<\/span>             {<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum41\" style=\"color: #606060;\"> 41:<\/span>                 <span style=\"color: #008000;\">\/\/temporarely disable item firing so that we do not end in the infinite loop<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum42\" style=\"color: #606060;\"> 42:<\/span>                 <span style=\"color: #0000ff;\">this<\/span>.DisableEventFiring();<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum43\" style=\"color: #606060;\"> 43:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum44\" style=\"color: #606060;\"> 44:<\/span>                 <span style=\"color: #008000;\">\/\/get the item itself on which the event was fired<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum45\" style=\"color: #606060;\"> 45:<\/span>                 SPListItem sharepointItem = properties.ListItem;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum46\" style=\"color: #606060;\"> 46:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum47\" style=\"color: #606060;\"> 47:<\/span>                 <span style=\"color: #008000;\">\/\/<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum48\" style=\"color: #606060;\"> 48:<\/span>                 <span style=\"color: #008000;\">\/\/now, get the same item with the elevated privileges <\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum49\" style=\"color: #606060;\"> 49:<\/span>                 <span style=\"color: #008000;\">\/\/we have to do it that way because we do not know which level of<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum50\" style=\"color: #606060;\"> 50:<\/span>                 <span style=\"color: #008000;\">\/\/permissions the current user has<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum51\" style=\"color: #606060;\"> 51:<\/span>                 SPSecurity.RunWithElevatedPrivileges(<span style=\"color: #0000ff;\">delegate<\/span>()<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum52\" style=\"color: #606060;\"> 52:<\/span>                 {<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum53\" style=\"color: #606060;\"> 53:<\/span>                     SPSite elevatedSite = <span style=\"color: #0000ff;\">new<\/span> SPSite(sharepointItem.ParentList.parentWeb.Site.ID);<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum54\" style=\"color: #606060;\"> 54:<\/span>                     SPWeb elevatedWeb = elevatedSite.OpenWeb(sharepointItem.ParentList.ParentWeb.ID);<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum55\" style=\"color: #606060;\"> 55:<\/span>                     SPList elevatedList = elevatedWeb.Lists[parentList.ID];<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum56\" style=\"color: #606060;\"> 56:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum57\" style=\"color: #606060;\"> 57:<\/span>                     <span style=\"color: #008000;\">\/\/get the file with the privileged permissions<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum58\" style=\"color: #606060;\"> 58:<\/span>                     SPListItem elevatedItem = elevatedList.Items.GetItemById(properties.ListItem.ID);<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum59\" style=\"color: #606060;\"> 59:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum60\" style=\"color: #606060;\"> 60:<\/span>                     <span style=\"color: #008000;\">\/\/<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum61\" style=\"color: #606060;\"> 61:<\/span>                     <span style=\"color: #008000;\">\/\/get the SharePoint group names from the feature configuration (Frature.xml file)<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum62\" style=\"color: #606060;\"> 62:<\/span>                     SPFeature feature = elevatedWeb.Features[<span style=\"color: #0000ff;\">new<\/span> Guid(<span style=\"color: #006080;\">\"98D6B8CB-1C6A-469c-9119-717AEBE68515\"<\/span>)];<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum63\" style=\"color: #606060;\"> 63:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum64\" style=\"color: #606060;\"> 64:<\/span>                     <span style=\"color: #0000ff;\">string<\/span> ownersGroupName = feature.Properties[<span style=\"color: #006080;\">\"OwnersGroupName\"<\/span>].Value;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum65\" style=\"color: #606060;\"> 65:<\/span>                     <span style=\"color: #0000ff;\">string<\/span> visitorsGroupName = feature.Properties[<span style=\"color: #006080;\">\"VisitorsGroupName\"<\/span>].Value;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum66\" style=\"color: #606060;\"> 66:<\/span>                     <span style=\"color: #0000ff;\">string<\/span> contributorsGroupName = feature.Properties[<span style=\"color: #006080;\">\"MySiteContributors\"<\/span>].Value;<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum67\" style=\"color: #606060;\"> 67:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum68\" style=\"color: #606060;\"> 68:<\/span>                     <span style=\"color: #008000;\">\/\/<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum69\" style=\"color: #606060;\"> 69:<\/span>                     <span style=\"color: #008000;\">\/\/do your logic here...<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum70\" style=\"color: #606060;\"> 70:<\/span>                     <span style=\"color: #008000;\">\/\/<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum71\" style=\"color: #606060;\"> 71:<\/span>                     <span style=\"color: #008000;\">\/\/<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum72\" style=\"color: #606060;\"> 72:<\/span>                     <span style=\"color: #008000;\">\/\/ break item permissions inheritance and assign new permissions based on <\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum73\" style=\"color: #606060;\"> 73:<\/span>                     <span style=\"color: #008000;\">\/\/ the values of the item meta properties<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum74\" style=\"color: #606060;\"> 74:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum75\" style=\"color: #606060;\"> 75:<\/span>                 });<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum76\" style=\"color: #606060;\"> 76:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum77\" style=\"color: #606060;\"> 77:<\/span>                 <span style=\"color: #008000;\">\/\/enable the event firing again<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum78\" style=\"color: #606060;\"> 78:<\/span>                 <span style=\"color: #0000ff;\">this<\/span>.EnableEventFiring();<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum79\" style=\"color: #606060;\"> 79:<\/span>             }<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum80\" style=\"color: #606060;\"> 80:<\/span>             <span style=\"color: #0000ff;\">catch<\/span> (Exception ex)<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum81\" style=\"color: #606060;\"> 81:<\/span>             {<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum82\" style=\"color: #606060;\"> 82:<\/span>                 Trace.WriteLine(ex.Message);<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum83\" style=\"color: #606060;\"> 83:<\/span>             }<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum84\" style=\"color: #606060;\"> 84:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum85\" style=\"color: #606060;\"> 85:<\/span>         }<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum86\" style=\"color: #606060;\"> 86:<\/span>     }<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum87\" style=\"color: #606060;\"> 87:<\/span> }<\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p>We\u2019ll first override our both event handlers (ItemAdded and ItemUpdated). As a parameter in the handler, we get an object of the <em>SPItemEventProperties<\/em> type \u2013 it contains an <em>SPListItem<\/em> object which is actually reference to our item.<\/p>\n<p>Since we want the same logic in both our events, we call the \u201cupdateItemPermissions\u201d method from both event handlers.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Note that we need to avoid the infinite loop<\/span><\/strong>: in the updateItemPermissions method, the first code line is <em>this.DisableEventFiring()<\/em> method call. It basically does what it says: stops firing this event again &#8211; we have to do that not to end up in the infinite loop, as the event would call itself (because we DO change our item in our event handler code). Of course, at the end, in the finally block, we have to call <em>this.EnableEventFiring()<\/em>.<\/p>\n<p>Further in the code, we get the same SPListItem (item we have added\/updated) with the elevated permissions (maybe the user who added item actually do not have rights to change permissions, but they still have to be changed?!)<\/p>\n<p>In the lines 61-66 there is an example for reading Feature properties from the Feature.xml file \u2013 in this example we just read the group names (explained with the Features.Xml file) .<\/p>\n<h5>Update Elements.Xml with the class library information<\/h5>\n<p>Compile the class library and copy the DLL manualy to the GAC (Global Assembly Cache) (c:windowsassembly). Now, open GAC in the Windows Explorer, find library\u2019s token (by right-clicking properties on library), and copy it to the Elements.xml in the PublicKeyToken part of the Assembly tag \u2013 as often as Assembly tag appears.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/topkenproperties_thumb_44DB68C2.gif\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"topkenproperties_thumb_44DB68C2\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/topkenproperties_thumb_44DB68C2_thumb.gif\" alt=\"topkenproperties_thumb_44DB68C2\" width=\"305\" height=\"349\" border=\"0\" \/><\/a><br \/>\nYou will also have to update Namespace and Class name of the Assembly and Class tags in the Elements.xml, it basically has to have this structure:<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum1\" style=\"color: #606060;\"> 1:<\/span> <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span>NameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=67d615643aea660a<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum2\" style=\"color: #606060;\"> 2:<\/span> <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span>NameSpace.ClassName<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p>in our example, it is going to be:<\/p>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum1\" style=\"color: #606060;\"> 1:<\/span> <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PermissionsEventHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=67d615643aea660a<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Assembly<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum2\" style=\"color: #606060;\"> 2:<\/span> <span style=\"color: #0000ff;\">&lt;<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span>PermissionsEventHandler.PermissionsHandler<span style=\"color: #0000ff;\">&lt;\/<\/span><span style=\"color: #800000;\">Class<\/span><span style=\"color: #0000ff;\">&gt;<\/span><\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h4>Deploying the event receiver feature<\/h4>\n<p>Since there is often a need to adjust Feature.Xml and Manifest.xml, i tend to have primary version of both Xml files in the solution directory, and, to deploy (copy) them to the SharePoint features directory within the deployment process.<\/p>\n<p>A current batch file can come pretty handy with deployment:<\/p>\n<h5>deployfeature.bat<\/h5>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum1\" style=\"color: #606060;\"> 1:<\/span> gacutil \/i <span style=\"color: #006080;\">\"..bindebugPermissionsEventHandler.dll\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum2\" style=\"color: #606060;\"> 2:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum3\" style=\"color: #606060;\"> 3:<\/span> copy feature.xml <span style=\"color: #006080;\">\"C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURESProjectDocumentPermissionsfeature.xml\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum4\" style=\"color: #606060;\"> 4:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum5\" style=\"color: #606060;\"> 5:<\/span> copy elements.xml <span style=\"color: #006080;\">\"C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURESProjectDocumentPermissionselements.xml\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum6\" style=\"color: #606060;\"> 6:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum7\" style=\"color: #606060;\"> 7:<\/span> stsadm -o installfeature -filename PermissionsEventHandlerFeature.xml<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum8\" style=\"color: #606060;\"> 8:<\/span> rem pause<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum9\" style=\"color: #606060;\"> 9:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum10\" style=\"color: #606060;\"> 10:<\/span> stsadm -o activatefeature -filename PermissionsEventHandlerFeature.xml -url http:<span style=\"color: #008000;\">\/\/myserver\/mysite\/<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum11\" style=\"color: #606060;\"> 11:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum12\" style=\"color: #606060;\"> 12:<\/span> iisreset<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum13\" style=\"color: #606060;\"> 13:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum14\" style=\"color: #606060;\"> 14:<\/span> echo <span style=\"color: #006080;\">\"Done\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p>The file is pretty self-explanatory: we first have to deploy our class library to the Global Assembly Cache, copy \u201clocal\u201d copy of the Feature.Xml and Elements.Xml files from Visual Studio solution to the SharePoint features directory, Install the feature using the STSADMIN command tool, and activate feature on our web site (<a href=\"http:\/\/myserver\/mysite\/)\">http:\/\/myserver\/mysite\/)<\/a>  &#8211; as well by using STSADMIN. And the necessary IISRESET.<\/p>\n<p>Sometimes, you\u2019ll need to undeploy the feature as well \u2013 and in the development process you\u2019ll do it as often as deploying the feature, believe me, and the following batch file can come handy then.<\/p>\n<h5>undelpoyfeature.bat<\/h5>\n<div id=\"codeSnippetWrapper\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;\">\n<div id=\"codeSnippet\" style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\">\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum1\" style=\"color: #606060;\"> 1:<\/span> stsadm -o deactivatefeature -filename PermissionsEventHandlerFeature.xml -url http:<span style=\"color: #008000;\">\/\/myserver\/mysite\/<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum2\" style=\"color: #606060;\"> 2:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum3\" style=\"color: #606060;\"> 3:<\/span> stsadm -o uninstallfeature -filename PermissionsEventHandlerFeature.xml -force<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum4\" style=\"color: #606060;\"> 4:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum5\" style=\"color: #606060;\"> 5:<\/span> del <span style=\"color: #006080;\">\"C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURESPermissionsEventHandlerfeature.xml\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum6\" style=\"color: #606060;\"> 6:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum7\" style=\"color: #606060;\"> 7:<\/span> del <span style=\"color: #006080;\">\"C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURESPermissionsEventHandlerelements.xml\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum8\" style=\"color: #606060;\"> 8:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum9\" style=\"color: #606060;\"> 9:<\/span> gacutil \/uf PermissionsEventHandler<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum10\" style=\"color: #606060;\"> 10:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum11\" style=\"color: #606060;\"> 11:<\/span> iisreset<\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum12\" style=\"color: #606060;\"> 12:<\/span><\/pre>\n<p>&nbsp;<\/p>\n<pre style=\"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;\"><span id=\"lnum13\" style=\"color: #606060;\"> 13:<\/span> echo <span style=\"color: #006080;\">\"Done\"<\/span><\/pre>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h4>Debug the feature<\/h4>\n<p>Debugging is kind of important when developing a new application \u2013 in this case event receiver. As a difference to the Windows Forms and Web applications, we cannot start our application here with F5: we need to set the break point somewhere, and wait until someone adds or edits a document.<\/p>\n<p>Furthermore, our DLL is in GAC. That means, that, for debugging, our PDB (symbols database) has to be in GAC as well. Since you can only add DLLs in GAC, there is no straight way how to do that. A simple trick which always works is to substitute GAC directory (C:WindowsAssembly) to a new drive letter (in command prompt):<\/p>\n<p><span style=\"font-family: Courier New;\">SUBST G: C:WindowsAssembly<\/span><\/p>\n<p>Now, if we open a \u201cdrive\u201d \u201cG\u201d in Windows Explorer, we will se a real structure of the GAC folder, not the one which is usually displayed when looking to c:windowsassembly.<\/p>\n<p>Now, we have to find a class library folder (it usually has the format <span style=\"font-family: Courier New;\">c:GAC_MSILClassLibraryNameversion__token<\/span>), and to copy our PDB in that folder.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/gacfolder_thumb_4B8E7245.gif\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"gacfolder_thumb_4B8E7245\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/gacfolder_thumb_4B8E7245_thumb.gif\" alt=\"gacfolder_thumb_4B8E7245\" width=\"537\" height=\"403\" border=\"0\" \/><\/a><\/p>\n<p>When we have done that, we have to attach our Visual Studio debugger to the IIS process where our SharePoint is executed. To do that, with your event handler solution still open, go to the Debug-&gt;Attach menu and select w3wp.exe process.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/attach_725C8885.gif\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"attach_725C8885\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/attach_725C8885_thumb.gif\" alt=\"attach_725C8885\" width=\"548\" height=\"361\" border=\"0\" \/><\/a><\/p>\n<p>And now, you can set the break point in your code and wait that somebody adds the file.<\/p>\n<p>I hope this helps someone \ud83d\ude42<\/p>\n<div class=\"fb-background-color\">\n\t\t\t  <div \n\t\t\t  \tclass = \"fb-comments\" \n\t\t\t  \tdata-href = \"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/\"\n\t\t\t  \tdata-numposts = \"59\"\n\t\t\t  \tdata-lazy = \"true\"\n\t\t\t\tdata-colorscheme = \"light\"\n\t\t\t\tdata-order-by = \"time\"\n\t\t\t\tdata-mobile=true>\n\t\t\t  <\/div><\/div>\n\t\t  <style>\n\t\t    .fb-background-color {\n\t\t\t\tbackground:  !important;\n\t\t\t}\n\t\t\t.fb_iframe_widget_fluid_desktop iframe {\n\t\t\t    width: 100% !important;\n\t\t\t}\n\t\t  <\/style>\n\t\t  ","protected":false},"excerpt":{"rendered":"<p>Develop and deploy a SharePoint Event Receiver from the scratch There are many information peaces on the internet how to build a decent working event receiver in SharePoint \u2013 mainly good, but still, only peaces. I\u2019ll try to present here a complete and quick \u201chow to\u201d guide &#8211; from making decision which event we want [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[11],"tags":[54,55],"class_list":["post-522","post","type-post","status-publish","format-standard","hentry","category-development","tag-server-object-model","tag-sharepoint"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SharePoint 2010 - Develop and deploy a SharePoint Event Receiver from the scratch - Adis Jugo blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SharePoint 2010 - Develop and deploy a SharePoint Event Receiver from the scratch - Adis Jugo blog\" \/>\n<meta property=\"og:description\" content=\"Develop and deploy a SharePoint Event Receiver from the scratch There are many information peaces on the internet how to build a decent working event receiver in SharePoint \u2013 mainly good, but still, only peaces. I\u2019ll try to present here a complete and quick \u201chow to\u201d guide &#8211; from making decision which event we want [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/\" \/>\n<meta property=\"og:site_name\" content=\"Adis Jugo blog\" \/>\n<meta property=\"article:published_time\" content=\"2011-04-26T09:18:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/topkenproperties_thumb_44DB68C2_thumb.gif\" \/>\n<meta name=\"author\" content=\"adis.jugo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"adis.jugo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/\",\"url\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/\",\"name\":\"SharePoint 2010 - Develop and deploy a SharePoint Event Receiver from the scratch - Adis Jugo blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/topkenproperties_thumb_44DB68C2_thumb.gif\",\"datePublished\":\"2011-04-26T09:18:12+00:00\",\"author\":{\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/a5ca63552094ce9d5a0440f3a1ac9a4c\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/#primaryimage\",\"url\":\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/topkenproperties_thumb_44DB68C2_thumb.gif\",\"contentUrl\":\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/topkenproperties_thumb_44DB68C2_thumb.gif\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.sharedove.com\/adisjugo\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SharePoint 2010 &#8211; Develop and deploy a SharePoint Event Receiver from the scratch\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/#website\",\"url\":\"https:\/\/blog.sharedove.com\/adisjugo\/\",\"name\":\"Adis Jugo blog\",\"description\":\"The Southern Side\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.sharedove.com\/adisjugo\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/a5ca63552094ce9d5a0440f3a1ac9a4c\",\"name\":\"adis.jugo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cc5a23cf1bd0b9d8401c9dd65c6c141041ec0c6e37eedbb511779e4a40a198fd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cc5a23cf1bd0b9d8401c9dd65c6c141041ec0c6e37eedbb511779e4a40a198fd?s=96&d=mm&r=g\",\"caption\":\"adis.jugo\"},\"url\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/author\/adisjugo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SharePoint 2010 - Develop and deploy a SharePoint Event Receiver from the scratch - Adis Jugo blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/","og_locale":"en_US","og_type":"article","og_title":"SharePoint 2010 - Develop and deploy a SharePoint Event Receiver from the scratch - Adis Jugo blog","og_description":"Develop and deploy a SharePoint Event Receiver from the scratch There are many information peaces on the internet how to build a decent working event receiver in SharePoint \u2013 mainly good, but still, only peaces. I\u2019ll try to present here a complete and quick \u201chow to\u201d guide &#8211; from making decision which event we want [&hellip;]","og_url":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/","og_site_name":"Adis Jugo blog","article_published_time":"2011-04-26T09:18:12+00:00","og_image":[{"url":"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/topkenproperties_thumb_44DB68C2_thumb.gif","type":"","width":"","height":""}],"author":"adis.jugo","twitter_card":"summary_large_image","twitter_misc":{"Written by":"adis.jugo","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/","url":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/","name":"SharePoint 2010 - Develop and deploy a SharePoint Event Receiver from the scratch - Adis Jugo blog","isPartOf":{"@id":"https:\/\/blog.sharedove.com\/adisjugo\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/#primaryimage"},"image":{"@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/topkenproperties_thumb_44DB68C2_thumb.gif","datePublished":"2011-04-26T09:18:12+00:00","author":{"@id":"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/a5ca63552094ce9d5a0440f3a1ac9a4c"},"breadcrumb":{"@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/#primaryimage","url":"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/topkenproperties_thumb_44DB68C2_thumb.gif","contentUrl":"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2010\/11\/topkenproperties_thumb_44DB68C2_thumb.gif"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2011\/04\/26\/sharepoint-2010-develop-and-deploy-a-sharepoint-event-receiver-from-the-scratch\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.sharedove.com\/adisjugo\/"},{"@type":"ListItem","position":2,"name":"SharePoint 2010 &#8211; Develop and deploy a SharePoint Event Receiver from the scratch"}]},{"@type":"WebSite","@id":"https:\/\/blog.sharedove.com\/adisjugo\/#website","url":"https:\/\/blog.sharedove.com\/adisjugo\/","name":"Adis Jugo blog","description":"The Southern Side","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.sharedove.com\/adisjugo\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/a5ca63552094ce9d5a0440f3a1ac9a4c","name":"adis.jugo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cc5a23cf1bd0b9d8401c9dd65c6c141041ec0c6e37eedbb511779e4a40a198fd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cc5a23cf1bd0b9d8401c9dd65c6c141041ec0c6e37eedbb511779e4a40a198fd?s=96&d=mm&r=g","caption":"adis.jugo"},"url":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/author\/adisjugo\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/posts\/522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/comments?post=522"}],"version-history":[{"count":0,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/posts\/522\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/media?parent=522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/categories?post=522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/tags?post=522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}