创建一个带有Event Receiver的List Definition
文章中介绍了详细的步骤, 还有一个视频可供下载.
文章地址:
Building List Definitions with Event Receiver in Windows SharePoint Services 3.0
http://msdn.microsoft.com/en-us/library/bb736146.aspx
另外, 看了这篇文章之后引出两个知识点.
Schema.xml
================
什么是List Definition? 顾名思义, 列表的定义.
那么如果不是自己开发的话, SharePoint的OOB(out of box)的list definition存储在哪里呢?
答: 两个文件内. 应用到列表上的SCHEMA.XML, 还有一个应用到整个站点上的ONET.XML.
任何一个出现在创建页面里的列表定义(List Definition)都在Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES
下面有一个自己的Feature子文件夹, 这些子文件夹都包含一个叫做Schema.xml的文件. 这个Schema.xml文件定义了views, forms, toolbar, 还有通过list definition创建出来的特殊fields.
下列任务可以被执行在Schema.xml上来自定义一个list definition
- 添加基于定义在FldTypes.xml中自定义的fields.(你不能创建自定义的base field type)
- 通过list definition, 为列表创建一个自定义的view.
- 指定服务于列表项的自定义表单页面.
- 指定列表出现在UI上的默认的描述信息.
- 定义list views(列表视图)旁边的导航区域中display的action area.
Schema.xml文档格式的说明, 可以参考下面的Schema.xml文章.
Onet.xml
================
在你安装Windows SharePoint Services 3.0的时候, 六个Onet.xml文件被部署到了安装目录下.
\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\GLOBAL\XML
这个应用在全局的部署中.- 另外五个在
...\TEMPLATE\SiteTemplates下面的随WSS一起ship的五个不同的site definition文件夹下面. 他们是Blog, Central Administration,Wiki, Meeting Workspace, team sites.
全局的Onet.xml定义了隐藏列表的列表模板, 列表的基本类型, 一个默认的列表定义配置, 还有应用到部署全局的模块. 另外的5个定义了navigational areas, list templates, document templates, configurations, modules, components, 还有用在五个站点定义中的server e-mail footer sections.
Onet.xml的功能
Define the top and side navigation areas that appear on the home page and in list views for a site definition.
Specify the list definitions that are used in each site definition and whether they are available for creating lists on the Create page.
Specify document templates that are available in the site definition for creating document library lists on the New page, and specify the files used in the document templates.
Define the base list types from which default Windows SharePoint Services lists are derived. (Only the global Onet.xml file serves this function.)
Specify the configurations of lists and modules that are used within each site definition.
Specify Windows SharePoint Services components.
Define the footer section used in server e-mail.
使用Onet.xml的web site definition
Specify an alternate cascading style sheet (CSS) file, JavaScript file, or ASPX header file for a site definition.
Modify navigation areas for the home page and list pages.
Add a list definition as an option to the Create page.
Add a document template for creating document libraries.
Define one or more configurations for the site definition, specifying the lists, modules, files, and Web Parts that are included when a site definition configuration is instantiated.
关于Onet.xml的格式说明, 请参考下面列出的文章Onet.xml.
Creating a List Definition
http://msdn.microsoft.com/en-us/library/dd587243(office.11).aspx
Schema.xml
http://msdn.microsoft.com/en-us/library/ms459356.aspx
Onet.xml