在新版本的SharePoint中,用户定制的Feature可以默认的增加到站点中。当给Site Definition 增加一个Feature后,那么从这个Site Definition中创建的站点上,这个Feature就会自动可以使用。
这个功能允许开发者创建Features并把它们接入到任何一个Site Definition中。在上一个版本的SharePoint中,现在以Feature的形式发布的功能,需要在每一个使用该功能的Site Definition中注册和配置。现在不需要这样做了,因为Feature封装了所有发布的功能。
将Features加入到Site Definitions
步骤1:
打开Site Definition的ONET.XML
找到为Samle Team Site 配置的那一节,其XML描述如下:
<Configuration ID="0" Name="Default">
<Lists>
<List FeatureId="00BFEA71-E717-4E80-AA17-D<chmetcnv unitname="C" sourcevalue="0" hasspace="False" negative="False" numbertype="1" tcsc="0" w:st="on">0C</chmetcnv>71B360101" Type="101" Title="$Resources:core,shareddocuments_Title;" Url="$Resources:core,shareddocuments_Folder;" QuickLaunchUrl="$Resources:core,shareddocuments_Folder;/Forms/AllItems.aspx" />
<List FeatureId="00BFEA71<chmetcnv unitname="a" sourcevalue="6" hasspace="False" negative="True" numbertype="1" tcsc="0" w:st="on">-6A</chmetcnv>49-43FA-B535-D<chmetcnv unitname="C" sourcevalue="15" hasspace="False" negative="False" numbertype="1" tcsc="0" w:st="on">15C</chmetcnv>05500108" Type="108" Title="$Resources:core,discussions_Title;" Url="$Resources:core,lists_Folder;/$Resources:core,discussions_Folder;" QuickLaunchUrl="$Resources:core,lists_Folder;/$Resources:core,discussions_Folder;/AllItems.aspx" EmailAlias="$Resources:core,discussions_EmailAlias;" />
<List FeatureId="00BFEA71-D1CE-42de<chmetcnv unitname="C" sourcevalue="9" hasspace="False" negative="True" numbertype="1" tcsc="0" w:st="on">-9C</chmetcnv>63-A44004CE0104" Type="104" Title="$Resources:core,announceList;" Url="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;">
<Data>
<Rows>
<Row>
<Field Name="Title">$Resources:onetid11;</Field>
<Field Name="Body">$Resources:onetid12;</Field>
<Field Name="Expires"><ows:TodayISO/></Field>
</Row>
</Rows>
</Data>
</List>
<List FeatureId="00BFEA71-2062<chmetcnv unitname="C" sourcevalue="426" hasspace="False" negative="True" numbertype="1" tcsc="0" w:st="on">-426C</chmetcnv>-90BF<chmetcnv unitname="C" sourcevalue="714" hasspace="False" negative="True" numbertype="1" tcsc="0" w:st="on">-714C</chmetcnv>59600103" Type="103" Title="$Resources:core,linksList;" Url="$Resources:core,lists_Folder;/$Resources:core,links_Folder;" />
<List FeatureId="00BFEA71-EC85-4903-972D-EBE475780106" Type="106" Title="$Resources:core,calendarList;" Url="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;" QuickLaunchUrl="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;/Calendar.aspx" EmailAlias="$Resources:core,calendar_EmailAlias;" />
<List FeatureId="00BFEA71-A83E-497E-9BA0<chmetcnv unitname="a" sourcevalue="7" hasspace="False" negative="True" numbertype="1" tcsc="0" w:st="on">-7A</chmetcnv><chmetcnv unitname="C" sourcevalue="5" hasspace="False" negative="False" numbertype="1" tcsc="0" w:st="on">5C</chmetcnv>597D0107" Type="107" Title="$Resources:core,taskList;" Url="$Resources:core,lists_Folder;/$Resources:core,tasks_Folder;" QuickLaunchUrl="$Resources:core,lists_Folder;/$Resources:core,tasks_Folder;/AllItems.aspx" />
</Lists>
<Modules>
<Module Name="Default" />
</Modules>
<SiteFeatures>
<!-- BasicWebParts Feature -->
<Feature ID="00BFEA71<chmetcnv unitname="C" sourcevalue="1" hasspace="False" negative="True" numbertype="1" tcsc="0" w:st="on">-1C</chmetcnv>5E<chmetcnv unitname="a" sourcevalue="4" hasspace="False" negative="True" numbertype="1" tcsc="0" w:st="on">-4A</chmetcnv>24-B310-BA<chmetcnv unitname="C" sourcevalue="51" hasspace="False" negative="False" numbertype="1" tcsc="0" w:st="on">51C</chmetcnv>3EB<chmetcnv unitname="a" sourcevalue="7" hasspace="False" negative="False" numbertype="1" tcsc="0" w:st="on">7A</chmetcnv>57" />
</SiteFeatures>
<WebFeatures>
<!-- TeamCollab Feature -->
<Feature ID="00BFEA71-4EA5-48D4-A4AD-7EA<chmetcnv unitname="C" sourcevalue="5" hasspace="False" negative="False" numbertype="1" tcsc="0" w:st="on">5C</chmetcnv>011ABE5" />
</WebFeatures>
</Configuration>
在<SiteFeatures>元素中增加如下的XML以把自己的定制的Document Library Feature加入:
<!-- Custom Common Document Library Feature -->
<Feature ID="<GUID OF YOUR FEATURE GOES HERE>" />
这个GUID和Feature.xml文件中GUID相对应。
步骤2:Reset IIS
步骤3:基于这个增加了Feature的站点定义创建一个新的站点。
创建完毕后在Site Features页面中会看到列表中有Custom Document Library Feature。按 Activeate 按钮可以激活这个Feature,激活后就可以基于这个Feature创建自己定制的Doument Library.
进一步的定制:
上一步实现了在Site Definition中增加Feature,并使它在创建站点的时候可用。现在要实现的一个功能是在创建站点时就从Feture中创建一个Custom Document Library.这样用户就不需要在站点创建完毕后再创建那个定制的Documnent Library.
以下步骤实现了从Site Definition中创建站点时Custom Document Library Feature被默认创建。
步骤1:编辑Site Definition 的ONET.XML文件
在刚刚编辑过的Configuration节的<Lists>元素中增加如下的XML:
<List FeatureId="<GUID OF YOUR FEATURE GOES HERE>"
Type="4000"
Title="$Resources:customDocumentLibrary,customDocumentLibrary_Title;"
Url="$Resources:customDocumentLibrary,customDocumentLibrary_Folder;"
QuickLaunchUrl="$Resources:customDocumentLibrary,customDocumentLibrary_Folder;/Forms/AllItems.aspx" />
或者:
<List FeatureId="<GUID OF YOUR FEATURE GOES HERE>"
Type="4000"
Title="Custom Document Library"
Url="Custom Document Library"
QuickLaunchUrl="Custom Document Library/Forms/AllItems.aspx" />
步骤2:Reset IIS
步骤3:创建一个基于这个Site Definition 的SharePoint 站点
效果如下
更进一步的定制
除了默认创建一个列表,我们还可以在根据Site Definition创建站点时在生成的主页上放置一个Custom Document Library 列表的视图。以下是步骤:
步骤1. 编辑Site Definition 的ONET.xml文件:
找到<Module>节,它是被Configuration 调用的。XML文本就像这样:
<Module Name="Default" Url="" Path="">
<File Url="default.aspx" NavBarHome="True">
<View List="$Resources:core,lists_Folder;/$Resources:core,announce_Folder;" BaseViewID="0" WebPartZoneID="Left" />
<View List="$Resources:core,lists_Folder;/$Resources:core,calendar_Folder;" BaseViewID="0" RecurrenceRowset="TRUE" WebPartZoneID="Left" WebPartOrder="2" />
<AllUsersWebPart WebPartZoneID="Right" WebPartOrder="1"><![CDATA[
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" xmlns:iwp="http://schemas.microsoft.com/WebPart/v2/Image">
<Assembly>Microsoft.SharePoint, Version=<chsdate year="1899" month="12" day="30" islunardate="False" isrocdate="False" w:st="on">12.0.0</chsdate>.0, Culture=neutral, PublicKeyToken=71e9bce111e<chmetcnv unitname="C" sourcevalue="9429" hasspace="False" negative="False" numbertype="1" tcsc="0" w:st="on">9429c</chmetcnv></Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ImageWebPart</TypeName>
<FrameType>None</FrameType>
<Title>$Resources:wp_SiteImage;</Title>
<iwp:ImageLink>/_layouts/images/homepage.gif</iwp:ImageLink>
</WebPart>
]]></AllUsersWebPart>
<View List="$Resources:core,lists_Folder;/$Resources:core,links_Folder;" BaseViewID="0" WebPartZoneID="Right" WebPartOrder="2" />
<NavBarPage Name="$Resources:core,nav_Home;" ID="1002" Position="Start" />
<NavBarPage Name="$Resources:core,nav_Home;" ID="0" Position="Start" />
</File>
</Module>
<Module>元素指明了调用它的Configurations所使用的资源, <File>元素指明了在Configuration中要实现的那些文件。在为default.aspx配置的<File>元素 中加入如下的XML以创建一个Custom Document Library列表。
<View List="Custom Document Library" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="3" />
或
<View List="$Resources:customDocumentLibrary,customDocumentLibrary_Folder;" BaseViewID="0" WebPartZoneID="Left" WebPartOrder="3" />
步骤2: Reset IIS
步骤3:根据Site Definition 创建站点
效果如下图所示:
注意:一旦通过STSADM.exe 在服务器上安装了某一个Feature则在各个已创建的网站上也可以使用,只是此时在这些网站上这个Feature并没有被激活。激活后即可使用。
分享到:
相关推荐
备份还原和迁移MOSS2007站点
对于MOSS 2007的开发和部署来说,Web部件和事件处理程序的开发并非难事,然而注册和部署却是一件麻烦的事情。 现在你可以通过《MOSS实用工具包》轻松地完成Web部件和事件处理程序的注册和部署。 下面简单介绍...
MOSS 2007 培训 MOSS 2007 培训 MOSS 2007 培训 MOSS 2007 培训 MOSS 2007 培训
从Moss2007的安装配置,到Webpart,Event Handler,Workflow基本开发方法。是学习Moss2007开发入门的一本好电子书。 希望对初学Moss2007开发的朋友有帮助。
MOSS2007的定制MOSS2007的定制
从MOSS2007升级到SharePoint2010方法介绍,使用无错误。
MOSS2007文档管理解决方案2007
安装MOSS2007 Windows Live
moss 2007开发教程,moss 2007开发教程(1).MOSS2007之概述
Moss2007下创建Form Authentication站点
SharePoint 2007部署文档 MOSS部署在SQLSERVER2005参考手册
MOSS 2007部署过程完整版 pdf
sharepoint 2007 moss
目前总结出两种简单的方法,都是用Moss本身和Excel进行操作,无需其他任何工具。一种是最基本的复制粘贴,第二种是利用Excel和Moss中的数据导入功能
Microsoft Office Sharepoint Server 2007开发系列课程 2 :MOSS2007之开发概述
moss 开发资料 webpart的开发
Moss 2007 2010 面试题 interview
如何配置sharepoint 2007的单点登录
moss环境搭建,从前期准备,到AD搭建,到安装.net framework,到安装数据库,到安装moss server,到配置,一应俱全。