Last week I was building a solution for a customer that involved setting item level security on a document in a document library the moment it is added to the document library.I'm not a big fan of item level security, because it can create chaos from a maintenance perspective, but sometimes it's simply the best, or even the only solution.
I started out be creating the feature that will contain the eventhandler.
The Feature.xml is very straightforward:<Feature Scope="Web" Title="Set Security Eventhandler" Id="7B2CB0DC-8F27-4252-A4F2-89729DF9331B" xmlns="http://schemas.microsoft.com/sharepoint/"> <ElementManifests> <ElementManifest Location="Elements.xml"/> </ElementManifests></Feature>
The Elements.xml looks like this:<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Receivers ListTemplateId="101"> <Receiver> <Name>AddedEventHandler</Name> <Type>ItemAdded</Type> <SequenceNumber>10000</SequenceNumber> <Assembly>Macaw.Custom.Moss2007.Portal.Business.Components, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6bdc41c2016ac3e3</Assembly> <Class>Macaw.Custom.Moss2007.Portal.Business.Components.SetSecurityEventHandler</Class> ...