And at this point you may hear a mental click as you see how
the feature.xml file is "run," which points to the newly GAC'd
assembly and its primary class, which has a FeatureActivated method that begins
the programmatic act of following your commands. Once this file has been run
with the STADM component you should be able to activate your new feature. Open
the site, Site Settings, Site Features and if all went well, somewhere in your
list should be your new feature. Take a moment to activate and deactivate it
and enjoy the knowledge that you now have the framework for your feature. Of
course it does not do much at this time, but let us review.
1.
Declarative Functionality – Back in the feature.xml file you have the
ability to reference a file called elements.xml. This file allows you to
declaratively create lists, build fields and attributes, populate the lists
with text data or point to data files to load into lists, build custom menu
items and much more. The declarative functionality of this file (or files if
you add and reference more element files) is quite extensive. In some ways this
functionality is similar to running an SQL script file that builds the tables,
fields, attributes and populates the data. Part two of this article will cover
many examples.
2.
Programmatic Functionality – The next part of this article will also
cover how the ReceiverAssembly and ReceiverClass objects call .NET code to
respond to events using the FeatureActivated, FeatureDeactivating,
FeatureInstalled and FeatureUninstalling methods. These methods, along with
their associated properties, become a gateway between your code and SharePoint.
3.
ASP.NET – As you have probably already learned, SharePoint is based on
ASP.NET, and as such the whole array of ASP.NET functionality is at your
disposal. In the process of building a SharePoint feature you can include not
only assemblies, but ASPX and ASCX objects, in addition to exposing canned and
custom functionality via ASMX and WCF.