sharepointsharepoint-2007eventreceiver

Adding a SharePoint feature with multiple class files


I am in the process of making a feature that consists of multiple items.

Currently it contains a Feature.xml file with 4 ElementManifest entries; two for a specific contenttype (Field definitions and FieldRefs), one for some webparts and the last is for a custom pagelayout. All of that is working fine.

I have altered the file with the contenttype (FieldRefs) to add a Receiver, since I wish to process whenever an item is added through the ItemAdding feature receiver. That part of the file looks as follows (I have removed the assembly and class names, but they are correct):

<XmlDocuments>
  <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
    <Receivers>
      <Receiver>
        <Name>NewsAlerts</Name>
        <Type>ItemAdding</Type>
        <SequenceNumber>10000</SequenceNumber>
        <Assembly>#AssemblyInfo#</Assembly>
        <Class>#NamespaceToClassFile#</Class>
        <Data></Data>
        <Filter></Filter>
      </Receiver>
    </Receivers>
  </XmlDocument>
</XmlDocuments>

Besides this file, I use a custom class file to add some functionality. For both the FeatureReceiver class and the custom class file, do I need to add anything to feature.xml or some of the other xml files to make sure they are included? I want it all added together as ONE feature.


Solution

  • Both your feature receiver assembly and the other one should be in the GAC. You can create a SharePoint solution that deploys your feature and puts the assemblies in the GAC so that they are available when the solution is installed.